[PATCH] D103180: [InstSimplify] Add constant fold for extractelement + splat for scalable vectors
Caroline via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 1 05:28:23 PDT 2021
CarolineConcatto added a comment.
Hi @foad,
I don't know if I understood correct your suggestion.
I did not change any line.
I have tried some combinations of IF removals, but they all broke some tests
================
Comment at: llvm/lib/IR/ConstantFold.cpp:916-917
return CAZ->getElementValue(CIdx->getZExtValue());
+ if (Constant *SplatVal = Val->getSplatValue())
+ return SplatVal;
}
----------------
foad wrote:
> You should be able to remove the two lines above handling the CAZ case, because your new code will handle it.
a
================
Comment at: llvm/lib/IR/ConstantFold.cpp:916-917
return CAZ->getElementValue(CIdx->getZExtValue());
+ if (Constant *SplatVal = Val->getSplatValue())
+ return SplatVal;
}
----------------
CarolineConcatto wrote:
> foad wrote:
> > You should be able to remove the two lines above handling the CAZ case, because your new code will handle it.
> a
Hi @foad
I believe we should keep these 2 tests:
!CIdx->uge(ValSVTy->getMinNumElements())
because it limits the index to be lower than the minimum width of the scalable vector.
and it should be only for scalable vector because of this
return CAZ->getElementValue(CIdx->getZExtValue());
transformation.
If we change to be vector type many other tests fail. For instance this one:
CodeGen/AMDGPU/amdgpu-codegenprepare-idiv.ll
Transforms/LoopVectorize/X86/gather_scatter.ll
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103180/new/
https://reviews.llvm.org/D103180
More information about the llvm-commits
mailing list