summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-05-17 19:00:05 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-05-17 19:00:05 +0000
commiteb185ca5e95aad1e3f61971bf1e39b1035b409d1 (patch)
tree4fbf8f1320a7c3c647dce772fd388f2a31cc2da8
parent1bafa6c8860f9227713892b58d6cf44eb41c9c4f (diff)
downloadbcm5719-llvm-eb185ca5e95aad1e3f61971bf1e39b1035b409d1.tar.gz
bcm5719-llvm-eb185ca5e95aad1e3f61971bf1e39b1035b409d1.zip
Revert constant-folding change that will miscompile in some cases.
llvm-svn: 51223
-rw-r--r--llvm/lib/VMCore/ConstantFold.cpp23
-rw-r--r--llvm/test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll8
2 files changed, 0 insertions, 31 deletions
diff --git a/llvm/lib/VMCore/ConstantFold.cpp b/llvm/lib/VMCore/ConstantFold.cpp
index 07df0bfba05..0913c481ad8 100644
--- a/llvm/lib/VMCore/ConstantFold.cpp
+++ b/llvm/lib/VMCore/ConstantFold.cpp
@@ -1029,29 +1029,6 @@ static ICmpInst::Predicate evaluateICmpRelation(const Constant *V1,
}
break;
- case Instruction::PtrToInt:
- case Instruction::IntToPtr:
- // inttoptr(x1) != inttoptr(x2) iff x1 != x2
- if (const ConstantExpr *CE2 = dyn_cast<ConstantExpr>(V2))
- if (CE1->getOpcode() == CE2->getOpcode()) {
- Constant *Op1 = const_cast<Constant*>(CE1Op0);
- Constant *Op2 = CE2->getOperand(0);
- if (Op1->getType() == Op2->getType()) {
- ConstantInt *R = 0;
-
- ICmpInst::Predicate pred = ICmpInst::ICMP_EQ;
- R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, Op1, Op2));
- if (R && !R->isZero())
- return pred;
-
- pred = ICmpInst::ICMP_NE;
- R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, Op1, Op2));
- if (R && !R->isZero())
- return pred;
- }
- }
- break;
-
case Instruction::GetElementPtr:
// Ok, since this is a getelementptr, we know that the constant has a
// pointer type. Check the various cases.
diff --git a/llvm/test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll b/llvm/test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll
index 1d93294fe45..e69de29bb2d 100644
--- a/llvm/test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll
+++ b/llvm/test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll
@@ -1,8 +0,0 @@
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false}
-; PR2329
-
-define i1 @f() {
- %x = icmp eq i8* inttoptr (i32 1 to i8*), inttoptr (i32 2 to i8*)
- ret i1 %x
-}
-
OpenPOWER on IntegriCloud