diff options
author | Chad Rosier <mcrosier@codeaurora.org> | 2017-07-07 13:55:55 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@codeaurora.org> | 2017-07-07 13:55:55 +0000 |
commit | 3f02123f7c3c4c33812ba7a1e6402c33dc0fd0d9 (patch) | |
tree | 8f8b172565933c222f26f7a8acb3e35cb6ad0a83 /llvm/test/Transforms/InstCombine/select-implied.ll | |
parent | 78b0f075f711bb16a261d9972b3154b3072e54d9 (diff) | |
download | bcm5719-llvm-3f02123f7c3c4c33812ba7a1e6402c33dc0fd0d9.tar.gz bcm5719-llvm-3f02123f7c3c4c33812ba7a1e6402c33dc0fd0d9.zip |
[ValueTracking] Fix the identity case (LHS => RHS) when the LHS is false.
Prior to this commit both of the added test cases were passing. However, in the
latter case (test7) we were doing a lot more work to arrive at the same answer
(i.e., we were using isImpliedCondMatchingOperands() to determine the
implication.).
llvm-svn: 307400
Diffstat (limited to 'llvm/test/Transforms/InstCombine/select-implied.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/select-implied.ll | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/select-implied.ll b/llvm/test/Transforms/InstCombine/select-implied.ll index 6b2ec7ffce7..2558745c18f 100644 --- a/llvm/test/Transforms/InstCombine/select-implied.ll +++ b/llvm/test/Transforms/InstCombine/select-implied.ll @@ -162,3 +162,39 @@ fpath: end: ret i32 0 } + +; LHS ==> RHS by definition (true -> true) +; CHECK-LABEL: @test6 +; CHECK: taken: +; CHECK-NOT: select +; CHECK: call void @foo(i32 10) +define void @test6(i32 %a, i32 %b) { + %cmp1 = icmp eq i32 %a, %b + br i1 %cmp1, label %taken, label %end + +taken: + %c = select i1 %cmp1, i32 10, i32 0 + call void @foo(i32 %c) + br label %end + +end: + ret void +} + +; LHS ==> RHS by definition (false -> false) +; CHECK-LABEL: @test7 +; CHECK: taken: +; CHECK-NOT: select +; CHECK: call void @foo(i32 11) +define void @test7(i32 %a, i32 %b) { + %cmp1 = icmp eq i32 %a, %b + br i1 %cmp1, label %end, label %taken + +taken: + %c = select i1 %cmp1, i32 0, i32 11 + call void @foo(i32 %c) + br label %end + +end: + ret void +} |