[PATCH] D130433: [InstCombine] Add fold for redundant sign bits count comparison
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 28 14:02:22 PDT 2022
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:1683
+ const APInt *ShiftC;
+ if (!match(Xor, m_c_Xor(m_Value(X), m_AShr(m_Deferred(X), m_APInt(ShiftC)))))
+ return nullptr;
----------------
What happens if the xor or ashr have other uses? We should bail out if this transform would increase the number of instructions.
We need 2 more tests to verify that. Try variations like this:
```
declare void @use(i8)
define i1 @ugt_extra_use(i8 %x) {
%y = ashr i8 %x, 5
%z = xor i8 %y, %x
call void @use(i8 %z)
%c = icmp ugt i8 %z, 1
ret i1 %c
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130433/new/
https://reviews.llvm.org/D130433
More information about the llvm-commits
mailing list