[llvm-commits] [llvm] r51223 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll
Nick Lewycky
nicholas at mxc.ca
Sat May 17 12:00:05 PDT 2008
Author: nicholas
Date: Sat May 17 14:00:05 2008
New Revision: 51223
URL: http://llvm.org/viewvc/llvm-project?rev=51223&view=rev
Log:
Revert constant-folding change that will miscompile in some cases.
Modified:
llvm/trunk/lib/VMCore/ConstantFold.cpp
llvm/trunk/test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll
Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=51223&r1=51222&r2=51223&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.cpp Sat May 17 14:00:05 2008
@@ -1029,29 +1029,6 @@
}
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.
Modified: llvm/trunk/test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll?rev=51223&r1=51222&r2=51223&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2008-05-17-FoldIntToPtr.ll Sat May 17 14:00:05 2008
@@ -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
-}
-
More information about the llvm-commits
mailing list