summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
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