diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-08-07 07:35:21 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-08-07 07:35:21 +0000 |
commit | 82ff022ed244831bb8926a26cc5dd64835b51ee8 (patch) | |
tree | 5477a162119d86a3536bd967cbe24f6b45297b9e /llvm/lib/Target/ARM/ARMConstantIslandPass.cpp | |
parent | b1aeeed03e2e8960d156c3ab164374f3f0ae60aa (diff) | |
download | bcm5719-llvm-82ff022ed244831bb8926a26cc5dd64835b51ee8.tar.gz bcm5719-llvm-82ff022ed244831bb8926a26cc5dd64835b51ee8.zip |
Error out, rather than infinite looping, if constant island pass can't converge.
llvm-svn: 78377
Diffstat (limited to 'llvm/lib/Target/ARM/ARMConstantIslandPass.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMConstantIslandPass.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp index 2f74133a66b..75e80d9b692 100644 --- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp +++ b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp @@ -271,15 +271,23 @@ bool ARMConstantIslands::runOnMachineFunction(MachineFunction &MF) { // Iteratively place constant pool entries and fix up branches until there // is no change. bool MadeChange = false; + unsigned NoCPIters = 0, NoBRIters = 0; while (true) { - bool Change = false; + bool CPChange = false; for (unsigned i = 0, e = CPUsers.size(); i != e; ++i) - Change |= HandleConstantPoolUser(MF, i); + CPChange |= HandleConstantPoolUser(MF, i); + if (CPChange && ++NoCPIters > 30) + llvm_unreachable("Constant Island pass failed to converge!"); DEBUG(dumpBBs()); + + bool BRChange = false; for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i) - Change |= FixUpImmediateBr(MF, ImmBranches[i]); + BRChange |= FixUpImmediateBr(MF, ImmBranches[i]); + if (BRChange && ++NoBRIters > 30) + llvm_unreachable("Branch Fix Up pass failed to converge!"); DEBUG(dumpBBs()); - if (!Change) + + if (!CPChange && !BRChange) break; MadeChange = true; } |