summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-10-01 06:53:28 +0000
committerHeejin Ahn <aheejin@gmail.com>2019-10-01 06:53:28 +0000
commite2bcab61009ab0ef0836385052d1a6027070c2b3 (patch)
tree8bf2bc7376a3505b63bf889f217f992ea167a2b0 /llvm/lib
parent61d5c76a181360ca8f039b2f6c914a18540684b5 (diff)
downloadbcm5719-llvm-e2bcab61009ab0ef0836385052d1a6027070c2b3.tar.gz
bcm5719-llvm-e2bcab61009ab0ef0836385052d1a6027070c2b3.zip
[WebAssembly] Make sure EH pads are preferred in sorting
Summary: In CFGSort, we try to make EH pads have higher priorities as soon as they are ready to be sorted, to prevent creation of unwind destination mismatches in CFGStackify. We did that by making priority queues' comparison function prefer EH pads, but it was possible for an EH pad to be popped from `Preferred` queue and then not sorted immediately and enter `Ready` queue instead in a certain condition. This patch makes sure that special condition does not consider EH pads as its candidates. Reviewers: dschuff Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68229 llvm-svn: 373302
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp
index 9f94866c089..c069af9eed6 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp
@@ -317,6 +317,7 @@ static void sortBlocks(MachineFunction &MF, const MachineLoopInfo &MLI,
// If Next was originally ordered before MBB, and it isn't because it was
// loop-rotated above the header, it's not preferred.
if (Next->getNumber() < MBB->getNumber() &&
+ (WasmDisableEHPadSort || !Next->isEHPad()) &&
(!R || !R->contains(Next) ||
R->getHeader()->getNumber() < Next->getNumber())) {
Ready.push(Next);
OpenPOWER on IntegriCloud