summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-11-10 23:36:56 +0000
committerCraig Topper <craig.topper@intel.com>2017-11-10 23:36:56 +0000
commitbdb8db458917cd3d6a0b1d9dd67cb86748c052fb (patch)
tree91525ef6204932fbb10e09f08bc8f546666693c2 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parentc631ba5f5270ee186835197e6deb315d740be51b (diff)
downloadbcm5719-llvm-bdb8db458917cd3d6a0b1d9dd67cb86748c052fb.tar.gz
bcm5719-llvm-bdb8db458917cd3d6a0b1d9dd67cb86748c052fb.zip
[SelectionDAG] Make getUniformBase in SelectionDAGBuilder fail if any of the middle GEP indices are non-constant.
This is a fix for a bug in r317947. We were supposed to check that all the indices are are constant 0, but instead we're only make sure that indices that are constant are 0. Non-constant indices are being ignored. llvm-svn: 317950
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 285f7eba099..e0155e73f55 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3884,10 +3884,11 @@ static bool getUniformBase(const Value* &Ptr, SDValue& Base, SDValue& Index,
Value *IndexVal = GEP->getOperand(FinalIndex);
// Ensure all the other indices are 0.
- for (unsigned i = 1; i < FinalIndex; ++i)
- if (auto *C = dyn_cast<ConstantInt>(GEP->getOperand(i)))
- if (!C->isZero())
- return false;
+ for (unsigned i = 1; i < FinalIndex; ++i) {
+ auto *C = dyn_cast<ConstantInt>(GEP->getOperand(i));
+ if (!C || !C->isZero())
+ return false;
+ }
// The operands of the GEP may be defined in another basic block.
// In this case we'll not find nodes for the operands.
OpenPOWER on IntegriCloud