[LLVMbugs] [Bug 2529] New: constant folding fails on vicmp instructions with undef operands

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jul 7 14:51:09 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2529

           Summary: constant folding fails on vicmp instructions with undef
                    operands
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sdt at rapidmind.com
                CC: llvmbugs at cs.uiuc.edu


For example, try passing the following through opt -instcombine:

define <4 x i32> @main(i32 %argc, i8** %argv) {
entry:  
        %foo = vicmp slt <4 x i32> <i32 undef, i32 undef, i32 undef, i32
undef>, <i32 undef, i32 undef, i32 undef, i32 undef>
        ret <4 x i32> %foo
}

This generates the following assertion:
opt: Value.cpp:319: void llvm::Value::replaceAllUsesWith(llvm::Value*):
Assertion `New->getType() == getType() && "replaceAllUses of value with new
value of different type!"' failed.

With the following backtrace:
#4  0x08680fa3 in llvm::Value::replaceAllUsesWith (this=0x87d57c8,
New=0x87d4a00) at Value.cpp:318
#5  0x0843b35e in AddReachableCodeToWorklist (BB=0x87d6a78,
Visited=@0xbfaabfd8, IC=@0x87d5180, TD=0x87d50b0) at
InstructionCombining.cpp:11245

Which is the last line of:
      if (Constant *C = ConstantFoldInstruction(Inst, TD)) {
        DOUT << "IC: ConstFold to: " << *C << " from: " << *Inst;
        Inst->replaceAllUsesWith(C);

It appears the vicmp got folded into an i1 undef, instead of a <4 x i32> undef.

The same problem exists for vfcmp as well.

This was tested on r53196.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list