aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-12-18 21:36:05 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-12-18 21:36:05 +0000
commitbd7b36e780f99b808f8e334e26f3dae1bc7e8175 (patch)
treed35231c0dd918a76c1af6e0d3800ea7af577afbb
parent9b04104a5e9fb51b24b7aeb55912d319802049b2 (diff)
Don't allow the automatically updated MI flags to be set directly.
The bundle-related MI flags need to be kept in sync with the neighboring instructions. Don't allow the bulk flag-setting setFlags() function to change them. Also don't copy MI flags when cloning an instruction. The clone's bundle flags will be set when it is explicitly inserted into a bundle. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170459 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CodeGen/MachineInstr.h4
-rw-r--r--lib/CodeGen/MachineInstr.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 320cd0dc53..c7b8360471 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -150,7 +150,9 @@ public:
}
void setFlags(unsigned flags) {
- Flags = flags;
+ // Filter out the automatically maintained flags.
+ unsigned Mask = BundledPred | BundledSucc;
+ Flags = (Flags & Mask) | (flags & ~Mask);
}
/// clearFlag - Clear a MI flag.
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index f545a9ce56..2d4392c47d 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -556,8 +556,8 @@ MachineInstr::MachineInstr(MachineFunction &MF, const MachineInstr &MI)
for (unsigned i = 0; i != MI.getNumOperands(); ++i)
addOperand(MI.getOperand(i));
- // Copy all the flags.
- Flags = MI.Flags;
+ // Copy all the sensible flags.
+ setFlags(MI.Flags);
// Set parent to null.
Parent = 0;