[PATCH] D60660: [InstCombine] Prune fshl/fshr with masked operands

Shawn Landden via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 14 14:48:25 PDT 2019


shawnl updated this revision to Diff 195081.
shawnl added a comment.

move up


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

https://reviews.llvm.org/D60660

Files:
  lib/Transforms/InstCombine/InstCombineCalls.cpp


Index: lib/Transforms/InstCombine/InstCombineCalls.cpp
===================================================================
--- lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -2049,6 +2049,10 @@
     Constant *ShAmtC;
     if (match(II->getArgOperand(2), m_Constant(ShAmtC)) &&
         !isa<ConstantExpr>(ShAmtC) && !ShAmtC->containsConstantExpression()) {
+      // Left or right might be masked
+      if (SimplifyDemandedBits(II))
+        return &CI;
+
       // Canonicalize a shift amount constant operand to modulo the bit-width.
       Constant *WidthC = ConstantInt::get(Ty, BitWidth);
       Constant *ModuloC = ConstantExpr::getURem(ShAmtC, WidthC);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60660.195081.patch
Type: text/x-patch
Size: 717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190414/47b66174/attachment.bin>


More information about the llvm-commits mailing list