[llvm] [InstCombine] Canonicalize scalable GEPs to use llvm.vscale intrinsic (PR #90569)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 30 06:29:08 PDT 2024
================
@@ -2787,6 +2787,14 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
GEP.isInBounds()));
}
+ // Canonicalize scalable GEPs to an explicit offset using the llvm.vscale
+ // intrinsic. This has better support in BasicAA.
+ if (IsGEPSrcEleScalable) {
+ Value *Offset = EmitGEPOffset(cast<GEPOperator>(&GEP));
+ return replaceInstUsesWith(
+ GEP, Builder.CreatePtrAdd(PtrOp, Offset, "", GEP.isInBounds()));
+ }
+
// Check to see if the inputs to the PHI node are getelementptr instructions.
----------------
davemgreen wrote:
There is a check for IsGEPSrcEleScalable below (and a comment), that could be removed now?
https://github.com/llvm/llvm-project/pull/90569
More information about the llvm-commits
mailing list