diff options
author | Craig Topper <craig.topper@intel.com> | 2019-08-14 21:38:56 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2019-08-14 21:38:56 +0000 |
commit | e7ea06b7d27b830e76be4c65498b54288daed05c (patch) | |
tree | ab2812b7ac09c9a72105652ebad3ac55104f4be4 /llvm/lib/CodeGen | |
parent | e1e844d6b0997b58625a59ab79d2f9aaf9c71bfd (diff) | |
download | bcm5719-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/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 9 |
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; } |