diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-03-14 20:06:27 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-03-14 20:06:27 +0000 |
commit | 56dba1a70834b2cc1735ca874ed2ae9178d448b9 (patch) | |
tree | a9f478a5eba175b61447f41eace0fc77303baf87 | |
parent | 8c403e4bf5c1e0a4438b0fea7e91b7259f061e78 (diff) | |
download | llvm-56dba1a70834b2cc1735ca874ed2ae9178d448b9.zip llvm-56dba1a70834b2cc1735ca874ed2ae9178d448b9.tar.gz llvm-56dba1a70834b2cc1735ca874ed2ae9178d448b9.tar.bz2 |
--- Merging r127464 into '.':
U test/Transforms/InstCombine/select.ll
U lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm-svn: 127609
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 5 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/select.ll | 10 |
2 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index 97abc76..8b9261b 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -503,9 +503,8 @@ static Value *foldSelectICmpAnd(const SelectInst &SI, ConstantInt *TrueVal, if (!IC || !IC->isEquality()) return 0; - if (ConstantInt *C = dyn_cast<ConstantInt>(IC->getOperand(1))) - if (!C->isZero()) - return 0; + if (!match(IC->getOperand(1), m_Zero())) + return 0; ConstantInt *AndRHS; Value *LHS = IC->getOperand(0); diff --git a/llvm/test/Transforms/InstCombine/select.ll b/llvm/test/Transforms/InstCombine/select.ll index ba9d99c..e9981a5 100644 --- a/llvm/test/Transforms/InstCombine/select.ll +++ b/llvm/test/Transforms/InstCombine/select.ll @@ -714,3 +714,13 @@ define i32 @test52(i32 %n, i32 %m) nounwind { ret i32 %storemerge } +; PR9454 +define i32 @test53(i32 %x) nounwind { + %and = and i32 %x, 2 + %cmp = icmp eq i32 %and, %x + %sel = select i1 %cmp, i32 2, i32 1 + ret i32 %sel +; CHECK: @test53 +; CHECK: select i1 %cmp +; CHECK: ret +} |