[PATCH] D55182: InstCombine: Scalarize single use icmp/fcmp
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 5 15:26:50 PST 2018
spatel added a comment.
In D55182#1316746 <https://reviews.llvm.org/D55182#1316746>, @spatel wrote:
> 2. There should be a test that shows the benefit of using 'isCheapToScalarize()'. IIUC, that would involve a sequence with multiple binops and/or compares between an insertelement and the trailing extract.
I added a binop test like this here:
rL348417 <https://reviews.llvm.org/rL348417>
...and it shows a missed opportunity. AFAICT, there was no test coverage for anything beyond the simplest cases for isCheapToScalarize(), so please do add something like that for cmp.
Also, I used 'match' to reduce the binop code:
rL348418 <https://reviews.llvm.org/rL348418>
cmp should be similar:
Value *X, *Y;
CmpInst::Predicate Pred;
if (match(SrcVec, m_Cmp(Pred, m_Value(X), m_Value(Y))) &&
cheapToScalarize(SrcVec, IndexC)) {
// extelt (cmp X, Y), Index --> cmp (extelt X, Index), (extelt Y, Index)
Value *E0 = Builder.CreateExtractElement(X, Index);
Value *E1 = Builder.CreateExtractElement(Y, Index);
return CmpInst::Create(cast<CmpInst>(SrcVec)->getOpcode(), Pred, E0, E1);
}
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55182/new/
https://reviews.llvm.org/D55182
More information about the llvm-commits
mailing list