[llvm] [RFC][GlobalISel] Use Builders in MatchTable (PR #65955)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 03:34:45 PDT 2023


================
@@ -71,14 +88,16 @@ bool GIMatchTableExecutor::executeMatchTable(
     return RejectAndResume;
   };
 
-  auto propagateFlags = [=](NewMIVector &OutMIs) {
-    for (auto MIB : OutMIs) {
+  auto propagateFlags = [&]() {
+    for (auto *MI : MTObserver.CreatedInsts) {
       // Set the NoFPExcept flag when no original matched instruction could
       // raise an FP exception, but the new instruction potentially might.
       uint16_t MIBFlags = Flags;
-      if (NoFPException && MIB->mayRaiseFPException())
+      if (NoFPException && MI->mayRaiseFPException())
         MIBFlags |= MachineInstr::NoFPExcept;
-      MIB.setMIFlags(MIBFlags);
+      Observer.changingInstr(*MI);
+      MI->setFlags(MIBFlags);
+      Observer.changedInstr(*MI);
----------------
qcolombet wrote:

I don't think that code is correct anymore.
Given we have no control on which instructions end up in the CreatedInsts list anymore, I don't think it is safe to propagate flags blindly.

I've pointed out this problem in one of the test case that is updated in that pass.

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


More information about the llvm-commits mailing list