[PATCH] D84664: [InstCombine] Fold shift-select if all the operands are constant

Matteo Favaro via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 27 12:59:34 PDT 2020


fvrmatteo added a comment.

I thought the same when I first saw those calls to **hasOneUse**, but if the code to handle the multiple users case that I added to **InstructionCombining.cpp** is kept and the calls to **SimplifySelectsFeedingBinaryOp** are removed from **InstCombineShifts.cpp**, the simplification won't work anymore.

In the example @nikic just shared, the single use-case it's handled by **commonShiftTransforms** -> **FoldShiftByConstant** (and not by **SimplifySelectsFeedingBinaryOp**, which is never called for the shifts, even though it would be correct to do so, I think),  but that doesn't seem to handle in a meaningful way the case where the incoming value to the shift it's use more than once.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84664/new/

https://reviews.llvm.org/D84664





More information about the llvm-commits mailing list