Skip to content

Conversation

thewilsonator
Copy link
Contributor

@thewilsonator thewilsonator commented Sep 6, 2025

This mostly fixes compilation for LLVM21, except for some breakage with regards to moving llvm.lifetime.start to taking only and AllocaInst (or a Poison).

; Function Attrs: uwtable(sync)
define void @_D3std3uni15decomposeHangulFNaNbNfwZSQBjQBi8Grapheme(ptr noalias sret(%std.uni.Grapheme) align 8 %0, i32 %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %std.uni.Grapheme, align 8
  %6 = alloca [1 x i32], align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %std.uni.Grapheme, align 8
  %13 = alloca [3 x i32], align 4
  %14 = alloca %std.uni.Grapheme, align 8
  %15 = alloca [2 x i32], align 4
  store i32 %1, ptr %3, align 4
  %16 = load i32, ptr %3, align 4
  %17 = sub i32 %16, 44032
  store i32 %17, ptr %4, align 4
  %18 = load i32, ptr %4, align 4
  %19 = icmp slt i32 %18, 0
  br i1 %19, label %23, label %20

20:                                               ; preds = %2
  %21 = load i32, ptr %4, align 4
  %22 = icmp sge i32 %21, 11172
  br label %23

23:                                               ; preds = %20, %2
  %24 = phi i1 [ true, %2 ], [ %22, %20 ]
  br i1 %24, label %25, label %35

25:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4 ; <<<<<<<<
  %26 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  store ptr null, ptr %26, align 8
  %27 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  store i64 0, ptr %27, align 8
  %28 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  store i64 0, ptr %28, align 8
  %29 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  store i64 0, ptr %29, align 8
  %30 = getelementptr inbounds [1 x i32], ptr %6, i32 0, i32 0
  %31 = load i32, ptr %3, align 4
  store i32 %31, ptr %30, align 4
  %32 = insertvalue { i64, ptr } { i64 1, ptr undef }, ptr %6, 1
  %33 = call ptr @_D3std3uni8Grapheme__T6__ctorTwZQkMFNaNbNcNiNfxAwXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %32) #3
  ret void

34:                                               ; No predecessors!
  br label %35

35:                                               ; preds = %34, %23
  call void @llvm.lifetime.end.p0(ptr captures(none) %5) #4
  %36 = load i32, ptr %4, align 4
  %37 = sdiv i32 %36, 588
  store i32 %37, ptr %7, align 4
  %38 = load i32, ptr %4, align 4
  %39 = srem i32 %38, 588
  %40 = sdiv i32 %39, 28
  store i32 %40, ptr %8, align 4
  %41 = load i32, ptr %4, align 4
  %42 = srem i32 %41, 28
  store i32 %42, ptr %9, align 4
  %43 = load i32, ptr %7, align 4
  %44 = add i32 4352, %43
  store i32 %44, ptr %10, align 4
  %45 = load i32, ptr %8, align 4
  %46 = add i32 4449, %45
  store i32 %46, ptr %11, align 4
  %47 = load i32, ptr %9, align 4
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %49, label %64

49:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %50 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  store ptr null, ptr %50, align 8
  %51 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  store i64 0, ptr %51, align 8
  %52 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  store i64 0, ptr %52, align 8
  %53 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  store i64 0, ptr %53, align 8
  %54 = getelementptr inbounds [3 x i32], ptr %13, i32 0, i32 0
  %55 = load i32, ptr %10, align 4
  store i32 %55, ptr %54, align 4
  %56 = getelementptr inbounds [3 x i32], ptr %13, i32 0, i32 1
  %57 = load i32, ptr %11, align 4
  store i32 %57, ptr %56, align 4
  %58 = getelementptr inbounds [3 x i32], ptr %13, i32 0, i32 2
  %59 = load i32, ptr %9, align 4
  %60 = add i32 4519, %59
  store i32 %60, ptr %58, align 4
  %61 = insertvalue { i64, ptr } { i64 3, ptr undef }, ptr %13, 1
  %62 = call ptr @_D3std3uni8Grapheme__T6__ctorTiZQkMFNaNbNcNiNfxAiXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %61) #3
  ret void

63:                                               ; No predecessors!
  br label %76

64:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %65 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  store ptr null, ptr %65, align 8
  %66 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  store i64 0, ptr %66, align 8
  %67 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  store i64 0, ptr %67, align 8
  %68 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  store i64 0, ptr %68, align 8
  %69 = getelementptr inbounds [2 x i32], ptr %15, i32 0, i32 0
  %70 = load i32, ptr %10, align 4
  store i32 %70, ptr %69, align 4
  %71 = getelementptr inbounds [2 x i32], ptr %15, i32 0, i32 1
  %72 = load i32, ptr %11, align 4
  store i32 %72, ptr %71, align 4
  %73 = insertvalue { i64, ptr } { i64 2, ptr undef }, ptr %15, 1
  %74 = call ptr @_D3std3uni8Grapheme__T6__ctorTiZQkMFNaNbNcNiNfxAiXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %73) #3
  ret void

75:                                               ; No predecessors!
  br label %76

76:                                               ; preds = %75, %63
  call void @llvm.lifetime.end.p0(ptr captures(none) %12) #4
  call void @llvm.lifetime.end.p0(ptr captures(none) %14) #4
  ret void
}

and

; Function Attrs: uwtable(sync)
define weak_odr void @_D3std3uni__T11memoizeExprVAyaa91_756e69636f64652e416c7068616265746963207c20756e69636f64652e4d6e207c20756e69636f64652e4d630a20202020202020207c20756e69636f64652e4d65207c20756e69636f64652e4e64207c20756e69636f64652e5063ZQHwFNfZSQIpQIo__T13InversionListTSQJpQJo8GcPolicyZQBh(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %0) #0 personality ptr @_d_eh_personality {
  %2 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %3 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %4 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %5 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %6 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %7 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %11 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %12 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %13 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %14 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"std.uni.InversionList!(GcPolicy).InversionList", align 8
  %18 = load i8, ptr @_D3std3uni__T11memoizeExprVAyaa91_756e69636f64652e416c7068616265746963207c20756e69636f64652e4d6e207c20756e69636f64652e4d630a20202020202020207c20756e69636f64652e4d65207c20756e69636f64652e4e64207c20756e69636f64652e5063ZQHwFZ11initializedb, align 1, !range !44
  %19 = trunc i8 %18 to i1
  %20 = xor i1 %19, true
  br i1 %20, label %21, label %35

21:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(ptr captures(none) %2) #4
  call void @llvm.lifetime.start.p0(ptr captures(none) %3) #4
  call void @llvm.lifetime.start.p0(ptr captures(none) %4) #4
  call void @llvm.lifetime.start.p0(ptr captures(none) %5) #4
  call void @llvm.lifetime.start.p0(ptr captures(none) %6) #4
  call void @_D3std3uni7unicode__T10opDispatchVAyaa10_416c7068616265746963ZQBpFNaNdNfZSQCuQCt__T13InversionListTSQDuQDt8GcPolicyZQBh(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %6) #3
  invoke void @_D3std3uni7unicode__T10opDispatchVAyaa2_4d6eZQyFNaNdNfZSQCcQCb__T13InversionListTSQDcQDb8GcPolicyZQBh(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %7) #3
          to label %22 unwind label %36

22:                                               ; preds = %21
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh__T8opBinaryVAyaa1_7cTSQCsQCr__TQCqTQCeZQCyZQBpMFNaNbNfQBhZQBl(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %5, ptr nonnull %6, ptr noalias align 8 captures(none) %7) #3
  invoke void @_D3std3uni7unicode__T10opDispatchVAyaa2_4d63ZQyFNaNdNfZSQCcQCb__T13InversionListTSQDcQDb8GcPolicyZQBh(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %10) #3
          to label %23 unwind label %42

23:                                               ; preds = %22
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh__T8opBinaryVAyaa1_7cTSQCsQCr__TQCqTQCeZQCyZQBpMFNaNbNfQBhZQBl(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %4, ptr nonnull %5, ptr noalias align 8 captures(none) %10) #3
  invoke void @_D3std3uni7unicode__T10opDispatchVAyaa2_4d65ZQyFNaNdNfZSQCcQCb__T13InversionListTSQDcQDb8GcPolicyZQBh(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %11) #3
          to label %24 unwind label %46

24:                                               ; preds = %23
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh__T8opBinaryVAyaa1_7cTSQCsQCr__TQCqTQCeZQCyZQBpMFNaNbNfQBhZQBl(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %3, ptr nonnull %4, ptr noalias align 8 captures(none) %11) #3
  invoke void @_D3std3uni7unicode__T10opDispatchVAyaa2_4e64ZQyFNaNdNfZSQCcQCb__T13InversionListTSQDcQDb8GcPolicyZQBh(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %12) #3
          to label %25 unwind label %50

25:                                               ; preds = %24
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh__T8opBinaryVAyaa1_7cTSQCsQCr__TQCqTQCeZQCyZQBpMFNaNbNfQBhZQBl(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %2, ptr nonnull %3, ptr noalias align 8 captures(none) %12) #3
  invoke void @_D3std3uni7unicode__T10opDispatchVAyaa2_5063ZQyFNaNdNfZSQCcQCb__T13InversionListTSQDcQDb8GcPolicyZQBh(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %14) #3
          to label %26 unwind label %54

26:                                               ; preds = %25
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh__T8opBinaryVAyaa1_7cTSQCsQCr__TQCqTQCeZQCyZQBpMFNaNbNfQBhZQBl(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %13, ptr nonnull %2, ptr noalias align 8 captures(none) %14) #3
  %27 = call ptr @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh8opAssignMFNaNbNcNjNeSQCrQCq__TQCpTQCdZQCxZQw(ptr nonnull @_D3std3uni__T11memoizeExprVAyaa91_756e69636f64652e416c7068616265746963207c20756e69636f64652e4d6e207c20756e69636f64652e4d630a20202020202020207c20756e69636f64652e4d65207c20756e69636f64652e4e64207c20756e69636f64652e5063ZQHwFZ4slotSQIsQIr__T13InversionListTSQJsQJr8GcPolicyZQBh, ptr noalias align 8 captures(none) %13) #0
  store ptr %27, ptr %15, align 8
  store i32 1, ptr %16, align 4
  br label %29

28:                                               ; preds = %33
  store i8 1, ptr @_D3std3uni__T11memoizeExprVAyaa91_756e69636f64652e416c7068616265746963207c20756e69636f64652e4d6e207c20756e69636f64652e4d630a20202020202020207c20756e69636f64652e4d65207c20756e69636f64652e4e64207c20756e69636f64652e5063ZQHwFZ11initializedb, align 1
  call void @llvm.lifetime.end.p0(ptr captures(none) %2) #4
  call void @llvm.lifetime.end.p0(ptr captures(none) %3) #4
  call void @llvm.lifetime.end.p0(ptr captures(none) %4) #4
  call void @llvm.lifetime.end.p0(ptr captures(none) %5) #4
  call void @llvm.lifetime.end.p0(ptr captures(none) %6) #4
  br label %35

29:                                               ; preds = %26, %54
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh11__fieldDtorMFNaNbNeZv(ptr nonnull %2) #0
  br label %30

30:                                               ; preds = %29, %50
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh11__fieldDtorMFNaNbNeZv(ptr nonnull %3) #0
  br label %31

31:                                               ; preds = %30, %46
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh11__fieldDtorMFNaNbNeZv(ptr nonnull %4) #0
  br label %32

32:                                               ; preds = %31, %42
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh11__fieldDtorMFNaNbNeZv(ptr nonnull %5) #0
  br label %33

33:                                               ; preds = %32, %36
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh11__fieldDtorMFNaNbNeZv(ptr nonnull %6) #0
  %34 = load i32, ptr %16, align 4
  switch i32 %34, label %40 [
    i32 1, label %28
  ]

35:                                               ; preds = %28, %1
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4 ; <<<<<<< Here
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %0, ptr align 1 @_D3std3uni__T11memoizeExprVAyaa91_756e69636f64652e416c7068616265746963207c20756e69636f64652e4d6e207c20756e69636f64652e4d630a20202020202020207c20756e69636f64652e4d65207c20756e69636f64652e4e64207c20756e69636f64652e5063ZQHwFZ4slotSQIsQIr__T13InversionListTSQJsQJr8GcPolicyZQBh, i64 16, i1 false)
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh15__fieldPostblitMFNaNbNiNlNeZv(ptr nonnull %0) #0
  ret void

36:                                               ; preds = %21
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %8, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %9, align 4
  store i32 0, ptr %16, align 4
  br label %33

40:                                               ; preds = %33
  %41 = load ptr, ptr %8, align 8
  call void @_Unwind_Resume(ptr %41)
  unreachable

42:                                               ; preds = %22
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %8, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %9, align 4
  store i32 0, ptr %16, align 4
  br label %32

46:                                               ; preds = %23
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %8, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %9, align 4
  store i32 0, ptr %16, align 4
  br label %31

50:                                               ; preds = %24
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %8, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %9, align 4
  store i32 0, ptr %16, align 4
  br label %30

54:                                               ; preds = %25
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %8, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %9, align 4
  store i32 0, ptr %16, align 4
  br label %29
}

(the above ` | grep "%0")

define weak_odr void @_D3std3uni__T11memoizeExprVAyaa91_756e69636f64652e416c7068616265746963207c20756e69636f64652e4d6e207c20756e69636f64652e4d630a20202020202020207c20756e69636f64652e4d65207c20756e69636f64652e4e64207c20756e69636f64652e5063ZQHwFNfZSQIpQIo__T13InversionListTSQJpQJo8GcPolicyZQBh(ptr noalias sret(%"std.uni.InversionList!(GcPolicy).InversionList") align 8 %0) #0 personality ptr @_d_eh_personality {
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %0, ptr align 1 @_D3std3uni__T11memoizeExprVAyaa91_756e69636f64652e416c7068616265746963207c20756e69636f64652e4d6e207c20756e69636f64652e4d630a20202020202020207c20756e69636f64652e4d65207c20756e69636f64652e4e64207c20756e69636f64652e5063ZQHwFZ4slotSQIsQIr__T13InversionListTSQJsQJr8GcPolicyZQBh, i64 16, i1 false)
  call void @_D3std3uni__T13InversionListTSQBcQBb8GcPolicyZQBh15__fieldPostblitMFNaNbNiNlNeZv(ptr nonnull %0) #0
ptr %0
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
define void @_D3std3uni15decomposeHangulFNaNbNfwZSQBjQBi8Grapheme(ptr noalias sret(%std.uni.Grapheme) align 8 %0, i32 %1) #0 {
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %26 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  %27 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  %28 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  %29 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  %33 = call ptr @_D3std3uni8Grapheme__T6__ctorTwZQkMFNaNbNcNiNfxAwXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %32) #3
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %50 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  %51 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  %52 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  %53 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  %62 = call ptr @_D3std3uni8Grapheme__T6__ctorTiZQkMFNaNbNcNiNfxAiXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %61) #3
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %65 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  %66 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  %67 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  %68 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  %74 = call ptr @_D3std3uni8Grapheme__T6__ctorTiZQkMFNaNbNcNiNfxAiXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %73) #3
define void @_D3std3uni15decomposeHangulFNaNbNfwZSQBjQBi8Grapheme(ptr noalias sret(%std.uni.Grapheme) align 8 %0, i32 %1) #0 {
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %26 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  %27 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  %28 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  %29 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  %33 = call ptr @_D3std3uni8Grapheme__T6__ctorTwZQkMFNaNbNcNiNfxAwXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %32) #3
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %50 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  %51 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  %52 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  %53 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  %62 = call ptr @_D3std3uni8Grapheme__T6__ctorTiZQkMFNaNbNcNiNfxAiXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %61) #3
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %65 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  %66 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  %67 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  %68 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  %74 = call ptr @_D3std3uni8Grapheme__T6__ctorTiZQkMFNaNbNcNiNfxAiXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %73) #3
define void @_D3std3uni15decomposeHangulFNaNbNfwZSQBjQBi8Grapheme(ptr noalias sret(%std.uni.Grapheme) align 8 %0, i32 %1) #0 {
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %26 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  %27 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  %28 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  %29 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  %33 = call ptr @_D3std3uni8Grapheme__T6__ctorTwZQkMFNaNbNcNiNfxAwXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %32) #3
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %50 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  %51 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  %52 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  %53 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  %62 = call ptr @_D3std3uni8Grapheme__T6__ctorTiZQkMFNaNbNcNiNfxAiXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %61) #3
  call void @llvm.lifetime.start.p0(ptr captures(none) %0) #4
  %65 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 0
  %66 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 1
  %67 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 2
  %68 = getelementptr inbounds %std.uni.Grapheme, ptr %0, i32 0, i32 3
  %74 = call ptr @_D3std3uni8Grapheme__T6__ctorTiZQkMFNaNbNcNiNfxAiXSQBxQBwQBv(ptr nonnull returned %0, { i64, ptr } %73) #3

which both produce a call to @llvm.lifetime.start.p0(ptr captures(none) %0) and %0 in this case is an Argument not an AllocaInst.

I'm trying to figure out where those calls are coming from. Is it the ABI messing things up somehow? I don't know what is special about those functions.

% git grep getLLVMLifetimeStartFn
variable_lifetime.cpp:  irs.CreateCallOrInvoke(getLLVMLifetimeStartFn(),
variable_lifetime.cpp:llvm::Function *LocalVariableLifetimeAnnotator::getLLVMLifetimeStartFn() {
variable_lifetime.h:  llvm::Function *getLLVMLifetimeStartFn();

there is only the one use of it and

% git grep lifetime_start
variable_lifetime.cpp:      &irs.module, llvm::Intrinsic::lifetime_start, allocaType);

@JohanEngelen
Copy link
Member

Did you check whether those lifetime calls are there for LLVM 20? (in the exact same functions?) Would help to get a standalone smaller testcase btw. Something like this: https://d.godbolt.org/z/d6f9763KE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants