summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-10-15 06:19:55 +0000
committerAndrew Trick <atrick@apple.com>2011-10-15 06:19:55 +0000
commitfd4ca0f4ac6dc992c26be029e162a5b21168b9ed (patch)
treeae7fdd644534c5a388faa24f087887cb7efb0067 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp
parente41fac231c9d1284409fa0bd1539f9f5eabdb1dc (diff)
downloadbcm5719-llvm-fd4ca0f4ac6dc992c26be029e162a5b21168b9ed.tar.gz
bcm5719-llvm-fd4ca0f4ac6dc992c26be029e162a5b21168b9ed.zip
Fix SCEVExpander assert during LSR: "argument of incompatible type".
Just because we're dealing with a GEP doesn't mean we can assert the SCEV has a pointer type. The fix is simply to ignore the SCEV pointer type, which we really didn't need. Fixes PR11138 webkit crash. llvm-svn: 142058
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolutionExpander.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index e76b6b10cf9..47f0f321161 100644
--- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -881,7 +881,7 @@ bool SCEVExpander::isNormalAddRecExprPHI(PHINode *PN, Instruction *IncV,
/// should match any patterns generated by getAddRecExprPHILiterally and
/// expandAddtoGEP.
bool SCEVExpander::isExpandedAddRecExprPHI(PHINode *PN, Instruction *IncV,
- const Loop *L, Type *ExpandTy) {
+ const Loop *L) {
switch (IncV->getOpcode()) {
// Check for a simple Add/Sub or GEP of a loop invariant step.
case Instruction::Add:
@@ -904,7 +904,7 @@ bool SCEVExpander::isExpandedAddRecExprPHI(PHINode *PN, Instruction *IncV,
// i1* is used by the expander to represent an address-size element.
if (IncV->getNumOperands() != 2)
return false;
- unsigned AS = cast<PointerType>(ExpandTy)->getAddressSpace();
+ unsigned AS = cast<PointerType>(IncV->getType())->getAddressSpace();
if (IncV->getType() != Type::getInt1PtrTy(SE.getContext(), AS)
&& IncV->getType() != Type::getInt8PtrTy(SE.getContext(), AS))
return false;
@@ -954,7 +954,7 @@ SCEVExpander::getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized,
cast<Instruction>(PN->getIncomingValueForBlock(LatchBlock));
if (LSRMode) {
- if (!isExpandedAddRecExprPHI(PN, IncV, L, ExpandTy))
+ if (!isExpandedAddRecExprPHI(PN, IncV, L))
continue;
}
else {
@@ -1547,9 +1547,8 @@ unsigned SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT,
cast<Instruction>(Phi->getIncomingValueForBlock(LatchBlock));
// If this phi is more canonical, swap it with the original.
- if (!isExpandedAddRecExprPHI(OrigPhiRef, OrigInc, L,
- OrigPhiRef->getType())
- && isExpandedAddRecExprPHI(Phi, IsomorphicInc, L, Phi->getType())) {
+ if (!isExpandedAddRecExprPHI(OrigPhiRef, OrigInc, L)
+ && isExpandedAddRecExprPHI(Phi, IsomorphicInc, L)) {
std::swap(OrigPhiRef, Phi);
std::swap(OrigInc, IsomorphicInc);
}
OpenPOWER on IntegriCloud