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

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 5 00:25:25 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:

Can we get the scope through `seh_scope_begin/seh_scope_end` etc.?

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


More information about the cfe-commits mailing list