diff options
author | Max Kazantsev <mkazantsev@azul.com> | 2020-07-17 16:59:19 +0700 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-07-20 15:28:01 +0200 |
commit | 7421cbd7a5a74b48a173f60763b9b78ecd3aec09 (patch) | |
tree | 7e4010f086f95e54c727866122a6834a1e6d0a74 | |
parent | 2a7f1931d7272051592155619f21b338b5735734 (diff) | |
download | llvm-7421cbd7a5a74b48a173f60763b9b78ecd3aec09.zip llvm-7421cbd7a5a74b48a173f60763b9b78ecd3aec09.tar.gz llvm-7421cbd7a5a74b48a173f60763b9b78ecd3aec09.tar.bz2 |
[InstCombine][Test] Test for fix of replacing select with Phis when branch has the same labels
An additional test that allows to check the correctness of handling the case of the same
branch labels in the dominator when trying to replace select with phi-node.
Patch By: Kirill Polushin
Differential Revision: https://reviews.llvm.org/D84006
Reviewed By: mkazantsev
(cherry picked from commit df6e185e8f895686510117301e568e5043909b66)
-rw-r--r-- | llvm/test/Transforms/InstCombine/select.ll | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/select.ll b/llvm/test/Transforms/InstCombine/select.ll index 8cd0e35..185ff83 100644 --- a/llvm/test/Transforms/InstCombine/select.ll +++ b/llvm/test/Transforms/InstCombine/select.ll @@ -2000,6 +2000,21 @@ merge: ret i32 %s } +define i32 @select_dominating_cond_same_labels(i1 %cond) { +; CHECK-LABEL: @select_dominating_cond_same_labels( +; CHECK-NEXT: entry: +; CHECK-NEXT: br i1 false, label [[EXIT:%.*]], label [[EXIT]] +; CHECK: exit: +; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[COND:%.*]], i32 123, i32 456 +; CHECK-NEXT: ret i32 [[RESULT]] +; +entry: + %result = select i1 %cond, i32 123, i32 456 + br i1 %cond, label %exit, label %exit +exit: + ret i32 %result +} + define i32 @select_phi_same_condition(i1 %cond, i32 %x, i32 %y, i32 %z) { ; CHECK-LABEL: @select_phi_same_condition( ; CHECK-NEXT: entry: |