[llvm] 431df3d - [SelectionDAGBuilder] Simplify the struct type handling in getUniformBase.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 13 14:00:40 PDT 2020
Author: Craig Topper
Date: 2020-03-13T14:00:21-07:00
New Revision: 431df3d873e9ebde40a014883060ec8e976194dd
URL: https://github.com/llvm/llvm-project/commit/431df3d873e9ebde40a014883060ec8e976194dd
DIFF: https://github.com/llvm/llvm-project/commit/431df3d873e9ebde40a014883060ec8e976194dd.diff
LOG: [SelectionDAGBuilder] Simplify the struct type handling in getUniformBase.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 397254b8855d..fed02b47cf2c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4424,16 +4424,9 @@ static bool getUniformBase(const Value *&Ptr, SDValue &Base, SDValue &Index,
if (STy) {
const StructLayout *SL = DL.getStructLayout(STy);
- if (isa<VectorType>(C->getType())) {
- C = C->getSplatValue();
- // FIXME: If getSplatValue may return nullptr for a structure?
- // If not, the following check can be removed.
- if (!C)
- return false;
- }
- auto *CI = cast<ConstantInt>(C);
+ unsigned Field = cast<Constant>(IndexVal)->getUniqueInteger().getZExtValue();
Scale = DAG.getTargetConstant(1, SDB->getCurSDLoc(), TLI.getPointerTy(DL));
- Index = DAG.getConstant(SL->getElementOffset(CI->getZExtValue()),
+ Index = DAG.getConstant(SL->getElementOffset(Field),
SDB->getCurSDLoc(), TLI.getPointerTy(DL));
} else {
Scale = DAG.getTargetConstant(
More information about the llvm-commits
mailing list