Support headerless bundles in MachineInstr::hasProperty().
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 10 Jan 2013 01:29:42 +0000 (01:29 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 10 Jan 2013 01:29:42 +0000 (01:29 +0000)
This function can still work without a BUNDLE header instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172029 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineInstr.h
lib/CodeGen/MachineInstr.cpp

index 3c7611f6a8200a7411f1547d2a6d4d0784236f66..3d2c61761c6d5a8a98b2ccf4dd508b3de9a62077 100644 (file)
@@ -314,7 +314,7 @@ public:
   /// instruction bundles.
   bool hasProperty(unsigned MCFlag, QueryType Type = AnyInBundle) const {
     // Inline the fast path.
   /// instruction bundles.
   bool hasProperty(unsigned MCFlag, QueryType Type = AnyInBundle) const {
     // Inline the fast path.
-    if (Type == IgnoreBundle || !isBundle())
+    if (Type == IgnoreBundle || !isBundled())
       return getDesc().getFlags() & (1 << MCFlag);
 
     // If we have a bundle, take the slow path.
       return getDesc().getFlags() & (1 << MCFlag);
 
     // If we have a bundle, take the slow path.
index 92f6a7f7699a823760e2fbe91345c71963910d77..cdf46b631f92af55b909392b9a81bb3f9c0244f8 100644 (file)
@@ -752,20 +752,18 @@ void MachineInstr::addMemOperand(MachineFunction &MF,
 }
 
 bool MachineInstr::hasPropertyInBundle(unsigned Mask, QueryType Type) const {
 }
 
 bool MachineInstr::hasPropertyInBundle(unsigned Mask, QueryType Type) const {
-  const MachineBasicBlock *MBB = getParent();
-  MachineBasicBlock::const_instr_iterator MII = *this; ++MII;
-  while (MII != MBB->end() && MII->isInsideBundle()) {
+  for (MachineBasicBlock::const_instr_iterator MII = this;; ++MII) {
     if (MII->getDesc().getFlags() & Mask) {
       if (Type == AnyInBundle)
         return true;
     } else {
     if (MII->getDesc().getFlags() & Mask) {
       if (Type == AnyInBundle)
         return true;
     } else {
-      if (Type == AllInBundle)
+      if (Type == AllInBundle && !MII->isBundle())
         return false;
     }
         return false;
     }
-    ++MII;
+    // This was the last instruction in the bundle.
+    if (!MII->isBundledWithSucc())
+      return Type == AllInBundle;
   }
   }
-
-  return Type == AllInBundle;
 }
 
 bool MachineInstr::isIdenticalTo(const MachineInstr *Other,
 }
 
 bool MachineInstr::isIdenticalTo(const MachineInstr *Other,