[llvm] 677a0de - [NFC][SimplifyCFG] Add test for sinking indirect calls
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 28 07:37:15 PDT 2021
Author: Roman Lebedev
Date: 2021-04-28T17:36:23+03:00
New Revision: 677a0dee648f50698137155709df16c388184054
URL: https://github.com/llvm/llvm-project/commit/677a0dee648f50698137155709df16c388184054
DIFF: https://github.com/llvm/llvm-project/commit/677a0dee648f50698137155709df16c388184054.diff
LOG: [NFC][SimplifyCFG] Add test for sinking indirect calls
Added:
Modified:
llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
Removed:
################################################################################
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)
More information about the llvm-commits
mailing list