[PATCH] D71442: [X86] Check if source elements are not structures before using a uniform base for the Gather/Scatter intrinsic.
LuoYuanke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 13 00:05:08 PST 2019
LuoYuanke added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4375
+ if (GTI.isStruct())
+ return false;
+
----------------
Maybe we can calculate the offset for struct if the index is constant.
APInt Offset(DL.getIndexTypeSizeInBits(GEP->getType()), 0);
if (!GEP->accumulateConstantOffset(DL, Offset))
return false;
Index = DAG.getTargetConstant(Offset, SDB->getCurSDLoc(), TLI.getPointerTy(DL));
Scale = DAG.getTargetConstant(1, SDB->getCurSDLoc(), TLI.getPointerTy(DL));
Also recognize zeroinitializer in accumulateConstantOffset().
--- a/llvm/lib/IR/Operator.cpp
+++ b/llvm/lib/IR/Operator.cpp
@@ -39,6 +39,9 @@ bool GEPOperator::accumulateConstantOffset(const DataLayout &DL,
for (gep_type_iterator GTI = gep_type_begin(this), GTE = gep_type_end(this);
GTI != GTE; ++GTI) {
+
+ if (isa<ConstantAggregateZero>(GTI.getOperand()))
+ continue;
ConstantInt *OpC = dyn_cast<ConstantInt>(GTI.getOperand());
if (!OpC)
return false;
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71442/new/
https://reviews.llvm.org/D71442
More information about the llvm-commits
mailing list