[llvm] ed4efee - [MemCpyOpt] Add additiona call slot unwind tests (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 02:49:31 PST 2022


Author: Nikita Popov
Date: 2022-01-26T11:49:24+01:00
New Revision: ed4efee2a3d45058aa1a6ffb463485046e981dc6

URL: https://github.com/llvm/llvm-project/commit/ed4efee2a3d45058aa1a6ffb463485046e981dc6
DIFF: https://github.com/llvm/llvm-project/commit/ed4efee2a3d45058aa1a6ffb463485046e981dc6.diff

LOG: [MemCpyOpt] Add additiona call slot unwind tests (NFC)

Test a possibly unwinding call with a byval and sret argument.

Added: 
    

Modified: 
    llvm/test/Transforms/MemCpyOpt/callslot_throw.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/MemCpyOpt/callslot_throw.ll b/llvm/test/Transforms/MemCpyOpt/callslot_throw.ll
index a3e2665120a91..ce0d575ab21b9 100644
--- a/llvm/test/Transforms/MemCpyOpt/callslot_throw.ll
+++ b/llvm/test/Transforms/MemCpyOpt/callslot_throw.ll
@@ -25,7 +25,7 @@ define void @test2(i32* nocapture noalias dereferenceable(4) %x) {
 ; CHECK-LABEL: @test2(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[T:%.*]] = alloca i32, align 4
-; CHECK-NEXT:    call void @may_throw(i32* nonnull [[T]]) [[ATTR0:#.*]]
+; CHECK-NEXT:    call void @may_throw(i32* nonnull [[T]]) #[[ATTR0:[0-9]+]]
 ; CHECK-NEXT:    [[LOAD:%.*]] = load i32, i32* [[T]], align 4
 ; CHECK-NEXT:    call void @always_throws()
 ; CHECK-NEXT:    store i32 [[LOAD]], i32* [[X:%.*]], align 4
@@ -39,3 +39,39 @@ entry:
   store i32 %load, i32* %x, align 4
   ret void
 }
+
+; TODO: byval argument is not visible on unwind.
+define void @test_byval(i32* nocapture noalias dereferenceable(4) byval(i32) %x) {
+; CHECK-LABEL: @test_byval(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[T:%.*]] = alloca i32, align 4
+; CHECK-NEXT:    call void @may_throw(i32* nonnull [[T]])
+; CHECK-NEXT:    [[LOAD:%.*]] = load i32, i32* [[T]], align 4
+; CHECK-NEXT:    store i32 [[LOAD]], i32* [[X:%.*]], align 4
+; CHECK-NEXT:    ret void
+;
+entry:
+  %t = alloca i32, align 4
+  call void @may_throw(i32* nonnull %t)
+  %load = load i32, i32* %t, align 4
+  store i32 %load, i32* %x, align 4
+  ret void
+}
+
+; TODO: With updated semantics, sret could also be invisible on unwind.
+define void @test_sret(i32* nocapture noalias dereferenceable(4) sret(i32) %x) {
+; CHECK-LABEL: @test_sret(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[T:%.*]] = alloca i32, align 4
+; CHECK-NEXT:    call void @may_throw(i32* nonnull [[T]])
+; CHECK-NEXT:    [[LOAD:%.*]] = load i32, i32* [[T]], align 4
+; CHECK-NEXT:    store i32 [[LOAD]], i32* [[X:%.*]], align 4
+; CHECK-NEXT:    ret void
+;
+entry:
+  %t = alloca i32, align 4
+  call void @may_throw(i32* nonnull %t)
+  %load = load i32, i32* %t, align 4
+  store i32 %load, i32* %x, align 4
+  ret void
+}


        


More information about the llvm-commits mailing list