[PATCH] D76190: CET for Exception Handle

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 15 18:15:41 PDT 2020


xiangzhangllvm marked 2 inline comments as done.
xiangzhangllvm added inline comments.


================
Comment at: llvm/lib/Target/X86/X86IndirectBranchTracking.cpp:132
+    // ENDBR before catch pad instructions.
+    bool EHPadIBTNeeded = false;
+    if (MBB.isEHPad())
----------------
LuoYuanke wrote:
> Line 131 ~ 134 can be merged to "bool EHPadIBTNeeded = MBB.isEHPad();"
Yes, you are right, thank you!


================
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));
----------------
LuoYuanke wrote:
> 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;
>   ...
> }
> ```
I have thought that, but it may cost 2 times loop to do it.


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