[LLVMbugs] [Bug 1244] NEW: Problem in instructioncombining

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Mar 8 19:05:58 PST 2007


           Summary: Problem in instructioncombining
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: wjiang at cs.ucla.edu

hi, I found a bug in TOT (instuction combiner). It tried to optimize (a<b)||
(a=b) to (a<=b), but the new predicate is wrong. 
The original code:
   %tmp266.i = icmp slt i32 %c.3.i, %d.292.2.i     
   %tmp276.i = icmp eq i32 %c.3.i, %d.292.2.i 
   %sel_tmp80 = or i1 %sel_tmp78, %sel_tmp79 
New code: 
   %sel_tmp187.demorgan.i = icmp ule i32 %c.3.i, %d.292.2.i 
                           --(should be sle)--

I looked the source codes, I guess the bug is in these lines:
struct FoldICmpLogical {
    Instruction *apply(Instruction &Log) const {
    Value *RV = getICmpValue(ICmpInst::isSignedPredicate(pred), 
           Code, LHS, RHS);
It only looks the second predicate: pred = eq for this example, so it return 
non-signed, but actually it's signed because the other preciate is slt. I guess 
both predicates should be looked at to get the correct results. I changed the 
code locally, it works
   Value *RV = getICmpValue(
   || ICmpInst::isSignedPredicate(cast<ICmpInst>(Log.getOperand(1))-
      Code, LHS, RHS);


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the llvm-bugs mailing list