diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2021-04-28 17:32:17 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2021-04-28 17:36:23 +0300 |
commit | 677a0dee648f50698137155709df16c388184054 (patch) | |
tree | c2d543c596fc3f8f2f92c978c65152a93bae7f61 | |
parent | 5f5974aeacac979de81713332ff80e5928e408b7 (diff) | |
download | llvm-677a0dee648f50698137155709df16c388184054.tar.gz |
[NFC][SimplifyCFG] Add test for sinking indirect calls
-rw-r--r-- | llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll b/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll index d771bdea52d7..917d1ab89eea 100644 --- a/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll +++ b/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll @@ -1381,5 +1381,31 @@ if.end: ret i32 1 } +define void @indirect_caller(i1 %c, i32 %v, void (i32)* %foo, void (i32)* %bar) { +; CHECK-LABEL: @indirect_caller( +; CHECK-NEXT: br i1 [[C:%.*]], label [[CALL_FOO:%.*]], label [[CALL_BAR:%.*]] +; CHECK: call_foo: +; CHECK-NEXT: tail call void [[FOO:%.*]](i32 [[V:%.*]]) +; CHECK-NEXT: br label [[END:%.*]] +; CHECK: call_bar: +; CHECK-NEXT: tail call void [[BAR:%.*]](i32 [[V]]) +; CHECK-NEXT: br label [[END]] +; CHECK: end: +; CHECK-NEXT: ret void +; + br i1 %c, label %call_foo, label %call_bar + +call_foo: + tail call void %foo(i32 %v) + br label %end + +call_bar: + tail call void %bar(i32 %v) + br label %end + +end: + ret void +} + declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) |