[Openmp-commits] [lldb] [clang] [llvm] [libcxx] [clang-tools-extra] [mlir] [openmp] [SEH] Fix register liveness verification for EHa (PR #76933)

Phoebe Wang via Openmp-commits openmp-commits at lists.llvm.org
Fri Jan 5 01:18:13 PST 2024


================
@@ -3347,10 +3348,37 @@ void MachineVerifier::verifyLiveRangeSegment(const LiveRange &LR,
     OwnerLI.computeSubRangeUndefs(Undefs, LaneMask, *MRI, *Indexes);
   }
 
+  bool IsEHa = MF->getMMI().getModule()->getModuleFlag("eh-asynch");
   while (true) {
     assert(LiveInts->isLiveInToMBB(LR, &*MFI));
-    // We don't know how to track physregs into a landing pad.
-    if (!Reg.isVirtual() && MFI->isEHPad()) {
+    auto IsSEHHandler = [](const MachineBasicBlock &Handler) -> bool {
+      if (!Handler.isMachineBlockAddressTaken())
+        return false;
+
+      for (const User *U : Handler.getBasicBlock()->users()) {
+        if (!isa<InvokeInst>(U))
+          continue;
+        const Function *Fn = cast<CallBase>(U)->getCalledFunction();
+        if (!Fn || !Fn->isIntrinsic())
+          continue;
+
+        switch (Fn->getIntrinsicID()) {
+        default:
+          continue;
+        case Intrinsic::seh_scope_begin:
+        case Intrinsic::seh_scope_end:
+        case Intrinsic::seh_try_begin:
+        case Intrinsic::seh_try_end:
+          return true;
+        }
+      }
+      return false;
+    };
+
+    // TODO: we don't know how to track physregs into a landing pad. For async
+    // EH, the virtual reg lives before scope begin, but we don't know seh scope
----------------
phoebewang wrote:

I once had an idea to lower them into pseudo instructions. But maybe need more work to do.

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


More information about the Openmp-commits mailing list