disable this instcombine xform, it miscompiles:
authorChris Lattner <sabre@nondot.org>
Fri, 28 Dec 2007 06:24:31 +0000 (06:24 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 28 Dec 2007 06:24:31 +0000 (06:24 +0000)
define i32 @main() {
entry:
%z = alloca i32 ; <i32*> [#uses=2]
store i32 0, i32* %z
%tmp = load i32* %z ; <i32> [#uses=1]
%sub = sub i32 %tmp, 1 ; <i32> [#uses=1]
%cmp = icmp ult i32 %sub, 0 ; <i1> [#uses=1]
%retval = select i1 %cmp, i32 1, i32 0 ; <i32> [#uses=1]
ret i32 %retval
}

into ret 1, instead of ret 0.

Christopher, please investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45383 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index d4278e3a7c7a40a41c11db437cae9da9c3ff1551..fc1443a9be85bdc7197b18ddea6e18a6d4fe79ce 100644 (file)
@@ -4835,9 +4835,11 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
   if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
       Value *A, *B;
     
+#if 0
     // (icmp cond (sub A B) 0) -> (icmp cond A B)
     if (CI->isNullValue() && match(Op0, m_Sub(m_Value(A), m_Value(B))))
       return new ICmpInst(I.getPredicate(), A, B);
+#endif
     
     switch (I.getPredicate()) {
     default: break;