[PATCH] Added a new transformation " (X + Y) - (X + Z) --> (Y - Z) "

David Majnemer david.majnemer at gmail.com
Wed Oct 15 23:56:46 PDT 2014


This instcombine is definitely not needed.  This sort of thing is best handled by reassociate. In fact, it already handles this case today:

`~/llvm/Debug+Asserts/bin/opt -reassociate -instcombine t.ll -o - -S`
  define i32 @test45(i32 %x, i32 %y, i32 %z) {
    %sub = sub i32 %y, %z
    ret i32 %sub
  }

http://reviews.llvm.org/D5813






More information about the llvm-commits mailing list