[llvm-branch-commits] [llvm-branch] r81027 - in /llvm/branches/release_26: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/icmp.ll
Tanya Lattner
tonic at nondot.org
Fri Sep 4 12:22:52 PDT 2009
Author: tbrethou
Date: Fri Sep 4 14:22:51 2009
New Revision: 81027
URL: http://llvm.org/viewvc/llvm-project?rev=81027&view=rev
Log:
Merge 80761 from mainline.
fix PR4837, some bugs folding vector compares. These
return a vector of i1, not i1 itself.
Modified:
llvm/branches/release_26/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/branches/release_26/test/Transforms/InstCombine/icmp.ll
Modified: llvm/branches/release_26/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/lib/Transforms/Scalar/InstructionCombining.cpp?rev=81027&r1=81026&r2=81027&view=diff
==============================================================================
--- llvm/branches/release_26/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/branches/release_26/lib/Transforms/Scalar/InstructionCombining.cpp Fri Sep 4 14:22:51 2009
@@ -5888,9 +5888,9 @@
// Fold trivial predicates.
if (I.getPredicate() == FCmpInst::FCMP_FALSE)
- return ReplaceInstUsesWith(I, ConstantInt::getFalse(*Context));
+ return ReplaceInstUsesWith(I, ConstantInt::get(I.getType(), 0));
if (I.getPredicate() == FCmpInst::FCMP_TRUE)
- return ReplaceInstUsesWith(I, ConstantInt::getTrue(*Context));
+ return ReplaceInstUsesWith(I, ConstantInt::get(I.getType(), 1));
// Simplify 'fcmp pred X, X'
if (Op0 == Op1) {
@@ -5899,11 +5899,11 @@
case FCmpInst::FCMP_UEQ: // True if unordered or equal
case FCmpInst::FCMP_UGE: // True if unordered, greater than, or equal
case FCmpInst::FCMP_ULE: // True if unordered, less than, or equal
- return ReplaceInstUsesWith(I, ConstantInt::getTrue(*Context));
+ return ReplaceInstUsesWith(I, ConstantInt::get(I.getType(), 1));
case FCmpInst::FCMP_OGT: // True if ordered and greater than
case FCmpInst::FCMP_OLT: // True if ordered and less than
case FCmpInst::FCMP_ONE: // True if ordered and operands are unequal
- return ReplaceInstUsesWith(I, ConstantInt::getFalse(*Context));
+ return ReplaceInstUsesWith(I, ConstantInt::get(I.getType(), 0));
case FCmpInst::FCMP_UNO: // True if unordered: isnan(X) | isnan(Y)
case FCmpInst::FCMP_ULT: // True if unordered or less than
@@ -5926,7 +5926,7 @@
}
if (isa<UndefValue>(Op1)) // fcmp pred X, undef -> undef
- return ReplaceInstUsesWith(I, UndefValue::get(Type::getInt1Ty(*Context)));
+ return ReplaceInstUsesWith(I, UndefValue::get(I.getType()));
// Handle fcmp with constant RHS
if (Constant *RHSC = dyn_cast<Constant>(Op1)) {
@@ -5996,11 +5996,11 @@
// icmp X, X
if (Op0 == Op1)
- return ReplaceInstUsesWith(I, ConstantInt::get(Type::getInt1Ty(*Context),
+ return ReplaceInstUsesWith(I, ConstantInt::get(I.getType(),
I.isTrueWhenEqual()));
if (isa<UndefValue>(Op1)) // X icmp undef -> undef
- return ReplaceInstUsesWith(I, UndefValue::get(Type::getInt1Ty(*Context)));
+ return ReplaceInstUsesWith(I, UndefValue::get(I.getType()));
// icmp <global/alloca*/null>, <global/alloca*/null> - Global/Stack value
// addresses never equal each other! We already know that Op0 != Op1.
Modified: llvm/branches/release_26/test/Transforms/InstCombine/icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/test/Transforms/InstCombine/icmp.ll?rev=81027&r1=81026&r2=81027&view=diff
==============================================================================
--- llvm/branches/release_26/test/Transforms/InstCombine/icmp.ll (original)
+++ llvm/branches/release_26/test/Transforms/InstCombine/icmp.ll Fri Sep 4 14:22:51 2009
@@ -28,3 +28,9 @@
ret i32 %1
}
+; PR4837
+define <2 x i1> @test5(<2 x i64> %x) {
+entry:
+ %V = icmp eq <2 x i64> %x, undef
+ ret <2 x i1> %V
+}
\ No newline at end of file
More information about the llvm-branch-commits
mailing list