summaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/ARMConstantIslandPass.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-08-07 07:35:21 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-08-07 07:35:21 +0000
commitb6879b2b84df2f642cd39f5bf58584c4a39f8080 (patch)
tree96802a9f4f6aa943c6090bd341cea3b4f021f74b /lib/Target/ARM/ARMConstantIslandPass.cpp
parent15c592ddffc8f0e8d973bb126bd95e5d9a559739 (diff)
downloadexternal_llvm-b6879b2b84df2f642cd39f5bf58584c4a39f8080.zip
external_llvm-b6879b2b84df2f642cd39f5bf58584c4a39f8080.tar.gz
external_llvm-b6879b2b84df2f642cd39f5bf58584c4a39f8080.tar.bz2
Error out, rather than infinite looping, if constant island pass can't converge.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMConstantIslandPass.cpp')
-rw-r--r--lib/Target/ARM/ARMConstantIslandPass.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp
index 2f74133..75e80d9 100644
--- a/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/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;
}