[llvm] r314276 - [X86] Remove erroneous callsite offsetting in SJLJ landing pads
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 26 23:08:16 PDT 2017
Author: mstorsjo
Date: Tue Sep 26 23:08:16 2017
New Revision: 314276
URL: http://llvm.org/viewvc/llvm-project?rev=314276&view=rev
Log:
[X86] Remove erroneous callsite offsetting in SJLJ landing pads
The callsite value is already stored indexed from 0 in
the _Unwind_Context struct. When accessed via the functions
_Unwind_GetIP and _Unwind_SetIP, the value is indexed from 1,
but those functions handle the offseting. When reading directly
from the struct here, we shouldn't subtract 1.
This matches the code generated by the ARM target, where SJLJ
exception handling is used by default on iOS.
This makes clang-built object files for 32 bit x86 mingw work when
linked with libgcc/libstdc++.
Differential Revision: https://reviews.llvm.org/D38251
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/sjlj-eh.ll
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=314276&r1=314275&r2=314276&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 26 23:08:16 2017
@@ -26576,17 +26576,13 @@ X86TargetLowering::EmitSjLjDispatchBlock
BuildMI(DispatchBB, DL, TII->get(X86::CMP32ri))
.addReg(IReg)
.addImm(LPadList.size());
- BuildMI(DispatchBB, DL, TII->get(X86::JA_1)).addMBB(TrapBB);
+ BuildMI(DispatchBB, DL, TII->get(X86::JAE_1)).addMBB(TrapBB);
- unsigned JReg = MRI->createVirtualRegister(&X86::GR32RegClass);
- BuildMI(DispContBB, DL, TII->get(X86::SUB32ri), JReg)
- .addReg(IReg)
- .addImm(1);
BuildMI(DispContBB, DL,
TII->get(Subtarget.is64Bit() ? X86::JMP64m : X86::JMP32m))
.addReg(0)
.addImm(Subtarget.is64Bit() ? 8 : 4)
- .addReg(JReg)
+ .addReg(IReg)
.addJumpTableIndex(MJTI)
.addReg(0);
Modified: llvm/trunk/test/CodeGen/X86/sjlj-eh.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sjlj-eh.ll?rev=314276&r1=314275&r2=314276&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/sjlj-eh.ll (original)
+++ llvm/trunk/test/CodeGen/X86/sjlj-eh.ll Tue Sep 26 23:08:16 2017
@@ -60,13 +60,12 @@ try.cont:
;
; CHECK: [[RESUME]]:
; CHECK: leal -64(%ebp), %esi
-; assert(UFC.__callsite <= 1);
+; assert(UFC.__callsite < 1);
; CHECK: movl -60(%ebp), %eax
; CHECK: cmpl $1, %eax
-; CHECK: jbe [[CONT:LBB[0-9]+_[0-9]+]]
+; CHECK: jb [[CONT:LBB[0-9]+_[0-9]+]]
; CHECK: ud2
; CHECK: [[CONT]]:
-; *Handlers[--UFC.__callsite]
-; CHECK: subl $1, %eax
+; *Handlers[UFC.__callsite]
; CHECK: jmpl *LJTI
More information about the llvm-commits
mailing list