summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/Analysis.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2015-05-04 20:41:51 +0000
committerTim Northover <tnorthover@apple.com>2015-05-04 20:41:51 +0000
commit851ff69b42e690cd8e7500218e1b7107749035c5 (patch)
tree96dce06a5d07ee0f232925695b9c58050d076e82 /llvm/lib/CodeGen/Analysis.cpp
parentb1225085012ad7fc8f45c3683a6220868273c284 (diff)
downloadbcm5719-llvm-851ff69b42e690cd8e7500218e1b7107749035c5.tar.gz
bcm5719-llvm-851ff69b42e690cd8e7500218e1b7107749035c5.zip
CodeGen: match up correct insertvalue indices when assessing tail calls.
When deciding whether a value comes from the aggregate or inserted value of an insertvalue instruction, we compare the indices against those of the location we're interested in. One of the lists needs reversing because the input data is backwards (so that modifications take place at the end of the SmallVector), but we were reversing both before leading to incorrect results. Should fix PR23408 llvm-svn: 236457
Diffstat (limited to 'llvm/lib/CodeGen/Analysis.cpp')
-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