Summary:
Currently when assigning depths 'rethrow' does not take the whole
control flow stack into accounts but only considers EH pad stacks. When
assigning depth immmediates to rethrows, in normal cases it is done
correctly but when a rethrow instruction throws up to a caller, i.e., we
convert a pseudo RETHROW_TO_CALLER instruction to a rethrow, it
mistakenly compute the whole stack depth.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D53619
llvm-svn: 345223
case WebAssembly::RETHROW_TO_CALLER: {
MachineInstr *Rethrow =
BuildMI(MBB, MI, MI.getDebugLoc(), TII.get(WebAssembly::RETHROW))
- .addImm(Stack.size());
+ .addImm(EHPadStack.size());
MI.eraseFromParent();
I = MachineBasicBlock::reverse_iterator(Rethrow);
break;
RETHROW_TO_CALLER implicit-def $arguments
; CHECK-LABEL: bb.7:
; CHECK-NEXT: END_TRY
- ; CHECK: RETHROW 3
+ ; CHECK: RETHROW 0
bb.8:
; predecessors: %bb.2, %bb.4