[PATCH] D76190: CET for Exception Handle

LuoYuanke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 15 08:00:53 PDT 2020


LuoYuanke added inline comments.


================
Comment at: llvm/lib/Target/X86/X86IndirectBranchTracking.cpp:132
+    // ENDBR before catch pad instructions.
+    bool EHPadIBTNeeded = false;
+    if (MBB.isEHPad())
----------------
Line 131 ~ 134 can be merged to "bool EHPadIBTNeeded = MBB.isEHPad();"


================
Comment at: llvm/lib/Target/X86/X86IndirectBranchTracking.cpp:142
+        // The first non-debug MI must be a EHLabel.
+        assert(I->isEHLabel() && "expected EH_LABEL");
         Changed |= addENDBR(MBB, std::next(I));
----------------
Does it looks better to insert endbr first for EHPAD block?

```
MachineBasicBlock::iterator I = MBB.begin();
if (MBB.isEHPad()) {
  for (; I != MBB.end(); ++I) {
    if (I->isDebugInstr()) continue;
  }
  Changed |= addENDBR(MBB, std::next(I));
  break;
}
for (; I != MBB.end(); ++I) {
  if (!I->isCall()) continue;
  ...
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76190/new/

https://reviews.llvm.org/D76190





More information about the llvm-commits mailing list