[LLVMbugs] [Bug 953] A bug + a fix in InstructionCombining

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Oct 18 10:40:28 PDT 2006


sabre at nondot.org changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

------- Additional Comments From sabre at nondot.org  2006-10-18 12:40 -------
Thank you for the bug report!  This bug has already been fixed in mainline CVS.  The code currently 
looks like:

    const Type *SrcTy = I->getOperand(0)->getType();
    if (!SrcTy->isIntegral()) return false;
    // If this is an integer truncate or noop, just look in the input.
    if (SrcTy->getPrimitiveSizeInBits() >= 
        I->getType()->getPrimitiveSizeInBits()) {
      // Cast to bool is a comparison against 0, which demands all bits.  We
      // can't propagate anything useful up.
      if (I->getType() == Type::BoolTy)
      if (SimplifyDemandedBits(I->getOperand(0), DemandedMask,
                               KnownZero, KnownOne, Depth+1))
        return true;
      assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); 

Your example now compiles into:

int %t(int %a, int %b) {
        %tmp1 = and int %a, 1           ; <int> [#uses=1]
        %tmp1 = setne int %tmp1, 0              ; <bool> [#uses=1]
        %tmp = setne int %b, 0          ; <bool> [#uses=1]
        %tmp3 = xor bool %tmp1, %tmp            ; <bool> [#uses=1]
        %tmp3 = cast bool %tmp3 to int          ; <int> [#uses=1]
        ret int %tmp3

While this happened to already be fixed, we welcome any bug reports for things you run into in the 



*** This bug has been marked as a duplicate of 913 ***

------- 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