[llvm-commits] [llvm] r137570 - in /llvm/trunk: lib/Transforms/InstCombine/InstructionCombining.cpp test/Transforms/InstCombine/nsw.ll

Eli Friedman eli.friedman at gmail.com
Sat Aug 13 20:00:43 PDT 2011


On Sat, Aug 13, 2011 at 6:45 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
> Author: nicholas
> Date: Sat Aug 13 20:45:19 2011
> New Revision: 137570
>
> URL: http://llvm.org/viewvc/llvm-project?rev=137570&view=rev
> Log:
> Teach instcombine to preserve the nsw bit by doing an after-the-fact analysis
> when combining add and sub instructions. Patch by Pranav Bhandarkar!

This appears to perform an incorrect transform for the following testcase:

define i32 @f(i32 %x) {
  %y = add i32 %x, 1
  %z = add nsw i32 %y, 2
  ret i32 %z
}

-Eli



More information about the llvm-commits mailing list