[llvm] [llvm-mca] Add -skip-unsupported-instructions option (PR #89733)

Peter Waller via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 10:07:39 PDT 2024


================
@@ -597,14 +610,25 @@ int main(int argc, char **argv) {
           // Default case.
           WithColor::error() << toString(std::move(NewE));
         }
+        if (SkipUnsupportedInstructions) {
+          DroppedInsts.insert(&MCI);
+          continue;
+        }
         return 1;
       }
 
       IPP->postProcessInstruction(Inst.get(), MCI);
-
+      InstToInstruments.insert({&MCI, Instruments});
       LoweredSequence.emplace_back(std::move(Inst.get()));
     }
 
+    Insts = Region->dropInstructions(DroppedInsts);
+
+    // Skip empty regions.
+    if (Insts.empty())
----------------
peterwaller-arm wrote:

The two are equivalent. It made sense to me to write the one that is most visible here, that is, we've just acquired a new array reference to `Insts` which backs the region. If this array is now empty, the region is empty. `Region->empty()` should be operating on the same array, so they are equivalent:

https://github.com/llvm/llvm-project/blob/e452750951d7e24c638a52c8cc22c377a3cde950/llvm/tools/llvm-mca/CodeRegion.h#L119

https://github.com/llvm/llvm-project/pull/89733


More information about the llvm-commits mailing list