mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
SCEVExpander: Don't crash when trying to merge two constant phis.
Just constant fold them so they can't cause any trouble. Fixes PR12627. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166286 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1618,6 +1618,17 @@ unsigned SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT,
|
||||
PEnd = Phis.end(); PIter != PEnd; ++PIter) {
|
||||
PHINode *Phi = *PIter;
|
||||
|
||||
// Fold constant phis. They may be congruent to other constant phis and
|
||||
// would confuse the logic below that expects proper IVs.
|
||||
if (Value *V = Phi->hasConstantValue()) {
|
||||
Phi->replaceAllUsesWith(V);
|
||||
DeadInsts.push_back(Phi);
|
||||
++NumElim;
|
||||
DEBUG_WITH_TYPE(DebugType, dbgs()
|
||||
<< "INDVARS: Eliminated constant iv: " << *Phi << '\n');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!SE.isSCEVable(Phi->getType()))
|
||||
continue;
|
||||
|
||||
|
Reference in New Issue
Block a user