[PATCH] D27582: Avoid infinite loops in branch folding

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 04:00:00 PST 2016


rnk added inline comments.


================
Comment at: lib/CodeGen/BranchFolding.cpp:1637
+          PrevBB.isSuccessor(&*FallThrough) &&
+          !FallThrough->isEHPad()) {
         MBB->moveAfter(&MF.back());
----------------
Let's check isEHPad before analyzeBranch. It's cheaper, and it makes no sense to try to arrange a fallthrough to an EH pad. The analogy with landingpads would be this situation:
```
  invoke ... to %unreachable unwind %lpad
next: ; cannot arrange fallthrough for some reason
  ret void
lpad:
  landingpad ...
```
Without your change, it looks like we'll try to get lpad to follow the invoke, which isn't useful.


================
Comment at: test/CodeGen/X86/branchfolding-catchpads.ll:98
+
+define void @test3() optsize personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
+entry:
----------------
Can we manually make this simpler?


Repository:
  rL LLVM

https://reviews.llvm.org/D27582





More information about the llvm-commits mailing list