[LLVMbugs] [Bug 9088] New: Instcombine fails to clear NSW/NUW flags when updating binops in place

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 28 08:37:14 PST 2011


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

           Summary: Instcombine fails to clear NSW/NUW flags when updating
                    binops in place
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: baldrick at free.fr
                CC: llvmbugs at cs.uiuc.edu


I noticed that InstCombiner::SimplifyAssociativeOrCommutative turns
(A * B) * C into A * (B * C) if it can simplify B * C.  Rather
than creating a new instruction it modifies "A * B" in place,
replacing B with whatever "B * C" simplified to.  Thus if A * B
was marked as not overflowing then the modified instruction will
also be marked as not overflowing since the flags are not touched.
But as far as I can see that is wrong: the modified instruction
could overflow even if the original one could not.

This update-in-place scheme seems to be used in a bunch of places
in instcombine, so it looks like instcombine needs to be audited
and nsw/nuw flags cleared in situations like this.

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