[PATCH] D67800: [InstCombine] Fold a shifty implementation of clamp (e.g., clamp255).

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 01:28:52 PDT 2019


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2685-2688
+    if (match(&I, m_c_Or(m_Value(Shift), m_Value(V))) &&
+        match(Shift,
+              m_OneUse(m_AShr(m_OneUse(m_NSWSub(m_APInt(C), m_Specific(V))),
+                              m_APInt(ShAmt)))) &&
----------------
same


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2689
+                              m_APInt(ShAmt)))) &&
+        *ShAmt == Ty->getScalarSizeInBits() - 1) {
+      Value *NewICmpInst =
----------------
As per the alive, this isn't needed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67800





More information about the llvm-commits mailing list