[llvm] r277484 - [GlobalISel] Set the Selected MF property.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 09:49:25 PDT 2016


Author: ab
Date: Tue Aug  2 11:49:25 2016
New Revision: 277484

URL: http://llvm.org/viewvc/llvm-project?rev=277484&view=rev
Log:
[GlobalISel] Set the Selected MF property.

None of GlobalISel requires the property, but this lets us use the
verifier instead of rolling our own "all instructions selected" check.

Modified:
    llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
    llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp
    llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir

Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelect.h?rev=277484&r1=277483&r2=277484&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelect.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/InstructionSelect.h Tue Aug  2 11:49:25 2016
@@ -37,6 +37,11 @@ public:
         .set(MachineFunctionProperties::Property::RegBankSelected);
   }
 
+  MachineFunctionProperties getSetProperties() const override {
+    return MachineFunctionProperties().set(
+        MachineFunctionProperties::Property::Selected);
+  }
+
   InstructionSelect();
 
   bool runOnMachineFunction(MachineFunction &MF) override;

Modified: llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp?rev=277484&r1=277483&r2=277484&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp Tue Aug  2 11:49:25 2016
@@ -85,20 +85,6 @@ bool InstructionSelect::runOnMachineFunc
 
   assert(MF.size() == NumBlocks && "Inserting blocks is not supported yet");
 
-  // Check that we did select everything. Do this separately to make sure we
-  // didn't miss any newly inserted instructions.
-  // FIXME: This (and other checks) should move into a verifier, predicated on
-  // a "post-isel" MachineFunction property. That would also let us selectively
-  // enable it depending on build configuration.
-  for (MachineBasicBlock &MBB : MF) {
-    for (MachineInstr &MI : MBB) {
-      if (isPreISelGenericOpcode(MI.getOpcode())) {
-        reportSelectionError(
-            MI, "Generic instruction survived instruction selection");
-      }
-    }
-  }
-
   // Now that selection is complete, there are no more generic vregs.
   // FIXME: We're still discussing what to do with the vreg->size map:
   // it's somewhat redundant (with the def MIs type size), but having to

Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir?rev=277484&r1=277483&r2=277484&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir Tue Aug  2 11:49:25 2016
@@ -31,6 +31,8 @@
   define void @store_s64_gpr(i64* %addr) { ret void }
   define void @store_s32_gpr(i32* %addr) { ret void }
 
+  define void @selected_property() { ret void }
+
 ...
 
 ---
@@ -419,3 +421,19 @@ body:             |
     G_STORE { s32, p0 }  %1, %0 :: (store 4 into %ir.addr)
 
 ...
+
+---
+# Check that we set the "selected" property.
+# CHECK-LABEL: name: selected_property
+# CHECK: legalized: true
+# CHECK-NEXT: regBankSelected: true
+# CHECK-NEXT: selected: true
+# CHECK-NEXT: isSSA: true
+name:            selected_property
+isSSA:           true
+legalized:       true
+regBankSelected: true
+selected:        false
+body:             |
+  bb.0:
+...




More information about the llvm-commits mailing list