[llvm] r281114 - Inliner: Don't mark swifterror allocas with lifetime markers

Arnold Schwaighofer via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 15:40:28 PDT 2016


Author: arnolds
Date: Fri Sep  9 17:40:27 2016
New Revision: 281114

URL: http://llvm.org/viewvc/llvm-project?rev=281114&view=rev
Log:
Inliner: Don't mark swifterror allocas with lifetime markers

This would create a bitcast use which fails the verifier: swifterror values may
only be used by loads, stores, and as function arguments.

rdar://28233244

Modified:
    llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
    llvm/trunk/test/Transforms/Inline/lifetime.ll

Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=281114&r1=281113&r2=281114&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Fri Sep  9 17:40:27 2016
@@ -1789,6 +1789,9 @@ bool llvm::InlineFunction(CallSite CS, I
     IRBuilder<> builder(&FirstNewBlock->front());
     for (unsigned ai = 0, ae = IFI.StaticAllocas.size(); ai != ae; ++ai) {
       AllocaInst *AI = IFI.StaticAllocas[ai];
+      // Don't mark swifterror allocas. They can't have bitcast uses.
+      if (AI->isSwiftError())
+        continue;
 
       // If the alloca is already scoped to something smaller than the whole
       // function then there's no need to add redundant, less accurate markers.

Modified: llvm/trunk/test/Transforms/Inline/lifetime.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/lifetime.ll?rev=281114&r1=281113&r2=281114&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/lifetime.ll (original)
+++ llvm/trunk/test/Transforms/Inline/lifetime.ll Fri Sep  9 17:40:27 2016
@@ -98,3 +98,20 @@ define void @test_arrays_alloca() {
 ; CHECK: ret void
   ret void
 }
+
+%swift.error = type opaque
+
+define void @helper_swifterror_alloca() {
+entry:
+  %swifterror = alloca swifterror %swift.error*, align 8
+  store %swift.error* null, %swift.error** %swifterror, align 8
+  ret void
+}
+
+define void @test_swifterror_alloca() {
+; CHECK-LABEL: @test_swifterror_alloca(
+; CHECK-NOT: lifetime
+  call void @helper_swifterror_alloca()
+; CHECK: ret void
+  ret void
+}




More information about the llvm-commits mailing list