[PATCH] D67799: [InstCombine] Fold a shifty implementation of clamp0.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 20 01:28:51 PDT 2019
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1933-1936
+ if (match(&I, m_c_And(m_Value(Shift), m_Value(V))) &&
+ match(Shift,
+ m_OneUse(m_AShr(m_OneUse(m_NSWSub(m_Zero(), m_Specific(V))),
+ m_APInt(ShAmt)))) &&
----------------
1. Only `m_AShr` has to be one-use
2. This doesn't actually deal with commutativity correctly
You want
```
match(&I, m_c_And(m_OneUse(m_AShr(m_NSWSub(m_Zero(),
m_Specific(V)),
m_APInt(ShAmt))),
m_Value(V)))
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67799/new/
https://reviews.llvm.org/D67799
More information about the llvm-commits
mailing list