[LLVMbugs] [Bug 3583] New: Correctness bug in commit r64314, trunk/lib/CodeGen/ SelectionDAG/TargetLowering.cpp

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Feb 14 02:37:24 PST 2009


           Summary: Correctness bug in commit r64314,
           Product: new-bugs
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: steinke-dirk at web.de
                CC: llvmbugs at cs.uiuc.edu

   bool ValueHasExactlyOneBitSet(SDValue Val, const SelectionDAG &DAG)
it is no longer safe to shortcut by
  if (Val.getOpcode() == ISD::SHL || Val.getOpcode() == ISD::SRL)
    return ValueHasExactlyOneBitSet(Val.getOperand(0), DAG);

Either the shortcut is dropped completely, or it has to be checked that the
shift-amount is not big enough to shift out the single 1-bit from the first

E.g. 0x8000 >> (y&15) has still exactly one bit set, although we don't know
exactly which one is.
But we know the first operands 1-bit position is 15, and the upper limit of the
shift amount is 15.

A more tricky case would be
    (0x8000 >> (y&14)) >> (z&1)
This is still safe, because the 1-bit position of the first operand is between
1 and 15, and the upper limit of the shift amount is 1.

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