aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/Thumb2SizeReduction.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-12-18 00:46:39 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-12-18 00:46:39 +0000
commitbcc9a89c16269cead71ba1f7063a8fb83fb8f57f (patch)
tree289386727b8eb2d705314091848df0588382968e /lib/Target/ARM/Thumb2SizeReduction.cpp
parentd57a5987733d0fbdf404e35a4438db2496a01fc5 (diff)
downloadexternal_llvm-bcc9a89c16269cead71ba1f7063a8fb83fb8f57f.zip
external_llvm-bcc9a89c16269cead71ba1f7063a8fb83fb8f57f.tar.gz
external_llvm-bcc9a89c16269cead71ba1f7063a8fb83fb8f57f.tar.bz2
Repair bundles that were broken by removing and reinserting the first
instruction. This isn't strictly necessary at the moment because Thumb2SizeReduction also copies all MI flags from the old instruction to the new. However, a future patch will make that kind of direct flag tampering illegal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/Thumb2SizeReduction.cpp')
-rw-r--r--lib/Target/ARM/Thumb2SizeReduction.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Target/ARM/Thumb2SizeReduction.cpp b/lib/Target/ARM/Thumb2SizeReduction.cpp
index 7e3b552..efc9bc3 100644
--- a/lib/Target/ARM/Thumb2SizeReduction.cpp
+++ b/lib/Target/ARM/Thumb2SizeReduction.cpp
@@ -896,13 +896,20 @@ bool Thumb2SizeReduce::ReduceMBB(MachineBasicBlock &MBB) {
LiveCPSR = UpdateCPSRUse(*MI, LiveCPSR);
+ // Does NextMII belong to the same bundle as MI?
+ bool NextInSameBundle = NextMII != E && NextMII->isBundledWithPred();
+
if (ReduceMI(MBB, MI, LiveCPSR, CPSRDef, IsSelfLoop)) {
Modified = true;
MachineBasicBlock::instr_iterator I = prior(NextMII);
MI = &*I;
+ // Removing and reinserting the first instruction in a bundle will break
+ // up the bundle. Fix the bundling if it was broken.
+ if (NextInSameBundle && !NextMII->isBundledWithPred())
+ NextMII->bundleWithPred();
}
- if (NextMII != E && MI->isInsideBundle() && !NextMII->isInsideBundle()) {
+ if (!NextInSameBundle && MI->isInsideBundle()) {
// FIXME: Since post-ra scheduler operates on bundles, the CPSR kill
// marker is only on the BUNDLE instruction. Process the BUNDLE
// instruction as we finish with the bundled instruction to work around