[PATCH] D108785: [WebAssembly] Fix PHI when relaying longjmps

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 26 17:25:59 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf5cff292e297: [WebAssembly] Fix PHI when relaying longjmps (authored by aheejin).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108785

Files:
  llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
  llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll


Index: llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll
===================================================================
--- llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll
+++ llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll
@@ -65,6 +65,10 @@
 ; CHECK-NEXT: %or = or i1 %cmp.eq.zero, %cmp.eq.one
 ; CHECK-NEXT: br i1 %or, label %tail, label %longjmp.rethrow
 
+; CHECK: try.cont:
+; CHECK-NEXT:  %phi = phi i32 [ undef, %tail ], [ undef, %lpad ]
+; CHECK-NEXT:  ret void
+
 ; CHECK:    tail:
 ; CHECK-NEXT: %cmp = icmp eq i32 %__THREW__.val, 1
 ; CHECK-NEXT: br i1 %cmp, label %lpad, label %try.cont
@@ -84,6 +88,7 @@
   br label %try.cont
 
 try.cont:                                         ; preds = %entry, %lpad
+ %phi = phi i32 [ undef, %entry ], [ undef, %lpad ]
   ret void
 }
 
Index: llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -891,6 +891,7 @@
 
         IRB.CreateUnreachable();
         IRB.SetInsertPoint(Tail);
+        BB.replaceSuccessorsPhiUsesWith(&BB, Tail);
       }
 
       // Insert a branch based on __THREW__ variable


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108785.369011.patch
Type: text/x-patch
Size: 1280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210827/8b400a6c/attachment.bin>


More information about the llvm-commits mailing list