[PATCH] D47891: [InstSimplify] shl nuw %x, %y -> %x iff KnownBits says %x is negative.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 7 10:55:43 PDT 2018


spatel added a subscriber: hfinkel.
spatel added a comment.

In https://reviews.llvm.org/D47891#1125281, @craig.topper wrote:

> If you use the generic instruction simplify entry point, we literally do call computeKnownBits on every input. It's the last thing we do if no simplications are found. If you call the individual instruction entry points like InstCombine does we don't do this. InstCombine itself will try to do something similar in main worklist processing code, but only when ExpensiveCombines is true. I've never understood why InstSimplify was more aggressive here.


Hmm...yes. IIRC, the difference with Eli's comment was that we could get knownbits for all operands, not just the inputs - and that would be even more costly of course.
This patch isn't the right place for the larger discussion, but cc'ing @hfinkel as I think both of the mentioned knownbits changes were made in https://reviews.llvm.org/rL251146. The ExpensiveCombines flag for instcombine was added later as a reaction to increased compile-time.


Repository:
  rL LLVM

https://reviews.llvm.org/D47891





More information about the llvm-commits mailing list