[PATCH] D22238: Reapply "InstCombine: Reduce trunc (shl x, K) width."

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 12:13:44 PDT 2016


majnemer accepted this revision.
This revision is now accepted and ready to land.

================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:540
@@ +539,3 @@
+    // dest type is native.
+    if (match(Src, m_And(m_Value(A), m_ConstantInt(Cst)))) {
+      Value *NewTrunc = Builder->CreateTrunc(A, DestTy, A->getName() + ".tr");
----------------
Can `m_ConstantInt` be `m_Constant` here?

================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:548
@@ +547,3 @@
+    // dest type is native and cst < dest size.
+    if (match(Src, m_Shl(m_Value(A), m_ConstantInt(Cst))) &&
+        !match(A, m_Shr(m_Value(), m_Constant()))) {
----------------
Could you use m_APInt instead of m_ConstantInt?


https://reviews.llvm.org/D22238





More information about the llvm-commits mailing list