summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/Analysis.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp
index 8e11fe1c9cf..ac0d40ec3a7 100644
--- a/llvm/lib/CodeGen/Analysis.cpp
+++ b/llvm/lib/CodeGen/Analysis.cpp
@@ -295,7 +295,8 @@ static const Value *getNoopInput(const Value *V,
} else if (const InsertValueInst *IVI = dyn_cast<InsertValueInst>(V)) {
// Value may come from either the aggregate or the scalar
ArrayRef<unsigned> InsertLoc = IVI->getIndices();
- if (std::equal(InsertLoc.rbegin(), InsertLoc.rend(),
+ assert(ValLoc.size() >= InsertLoc.size() && "extracting too deeply");
+ if (std::equal(InsertLoc.begin(), InsertLoc.end(),
ValLoc.rbegin())) {
// The type being inserted is a nested sub-type of the aggregate; we
// have to remove those initial indices to get the location we're
OpenPOWER on IntegriCloud