summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-08-14 21:38:56 +0000
committerCraig Topper <craig.topper@intel.com>2019-08-14 21:38:56 +0000
commite7ea06b7d27b830e76be4c65498b54288daed05c (patch)
treeab2812b7ac09c9a72105652ebad3ac55104f4be4 /llvm/lib
parente1e844d6b0997b58625a59ab79d2f9aaf9c71bfd (diff)
downloadbcm5719-llvm-e7ea06b7d27b830e76be4c65498b54288daed05c.tar.gz
bcm5719-llvm-e7ea06b7d27b830e76be4c65498b54288daed05c.zip
[SelectionDAGBuilder] Teach gather/scatter getUniformBase to look through vector zeroinitializer indices in addition to scalar zeroes.
llvm-svn: 368926
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index a3c3715bc72..b4e894a599f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4330,8 +4330,13 @@ static bool getUniformBase(const Value *&Ptr, SDValue &Base, SDValue &Index,
// Ensure all the other indices are 0.
for (unsigned i = 1; i < FinalIndex; ++i) {
- auto *C = dyn_cast<ConstantInt>(GEP->getOperand(i));
- if (!C || !C->isZero())
+ auto *C = dyn_cast<Constant>(GEP->getOperand(i));
+ if (!C)
+ return false;
+ if (isa<VectorType>(C->getType()))
+ C = C->getSplatValue();
+ auto *CI = dyn_cast_or_null<ConstantInt>(C);
+ if (!CI || !CI->isZero())
return false;
}
OpenPOWER on IntegriCloud