[PATCH] D39222: [InstCombine] Pull shifts through a select plus binop with constant

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 11:25:30 PST 2017


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM. See inline for a couple of other minor bits.



================
Comment at: lib/Transforms/InstCombine/InstCombineShifts.cpp:537-538
+
+    // If we have a select that conditionally executes some binary operator,
+    // see if we can pull it the select and operator through the shift.
+    Value *Cond;
----------------
```
// If we have a select that conditionally executes some binary operator,
// see if we can pull the shift and binop ahead of the select.

```
This would be clearer if we copied one of the test patterns in the comment as an example of this transform.


================
Comment at: lib/Transforms/InstCombine/InstCombineShifts.cpp:545-547
+      if (!isa<Constant>(FalseVal) && TBO->getOperand(0) == FalseVal &&
+          match(TBO->getOperand(1), m_APInt(C))) {
+        if (canShiftBinOpWithConstantRHS(I, TBO, *C)) {
----------------
More && clauses? Could combine these ifs.


https://reviews.llvm.org/D39222





More information about the llvm-commits mailing list