[PATCH] D77124: Handle CET for -exception-model sjlj

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 18:12:07 PDT 2020


xiangzhangllvm marked an inline comment as done.
xiangzhangllvm added inline comments.


================
Comment at: llvm/lib/Target/X86/X86IndirectBranchTracking.cpp:151
+      for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); ++I) {
+        // New Landingpad BB without EHLabel.
+        if (MBB.isEHPad()) {
----------------
hjl.tools wrote:
> Why do you have to iterate the same loop twice?
I move out the condition out of the loop, because in most time the "if" and "else if" is **false**.  
It will rarely come in to the loops (line 149-173).
I think it is more performance than putting these conditions into loop (line 141).
And the code is more readable than before.


================
Comment at: llvm/test/CodeGen/X86/indirect-branch-tracking-eh.ll:6
+; ALL-LABEL:   test_eh
+; X86_64:      endbr64
+; X86:         endbr32
----------------
LuoYuanke wrote:
> The test just show an endbr is inserted, but it doesn't demo where the endbr is inserted.
Yes, here just shows there one more endbr in sjlj model than other model. I'll refine it.


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

https://reviews.llvm.org/D77124





More information about the llvm-commits mailing list