Skip to content

Commit 1ae36b1

Browse files
committed
Remove special cases for invoke of non-throwing inline-asm.
Non-throwing inline asm infers the nounwind attribute in instcombine. Thus, it can be handled in the same manner as non-throwing target functions are generally. Further special casing is unnecessary complexity.
1 parent 7ce53e3 commit 1ae36b1

File tree

9 files changed

+9
-125
lines changed

9 files changed

+9
-125
lines changed

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,9 +2591,6 @@ bool IRTranslator::translateInvoke(const User &U,
25912591

25922592
bool LowerInlineAsm = I.isInlineAsm();
25932593
bool NeedEHLabel = true;
2594-
// If it can't throw then use a fast-path without emitting EH labels.
2595-
if (LowerInlineAsm)
2596-
NeedEHLabel = (cast<InlineAsm>(I.getCalledOperand()))->canThrow();
25972594

25982595
// Emit the actual call, bracketed by EH_LABELs so that the MF knows about
25992596
// the region covered by the try.

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8896,7 +8896,7 @@ void SelectionDAGBuilder::visitInlineAsm(const CallBase &Call,
88968896
// memory and is nonvolatile.
88978897
SDValue Flag, Chain = (HasSideEffect) ? getRoot() : DAG.getRoot();
88988898

8899-
bool EmitEHLabels = isa<InvokeInst>(Call) && IA->canThrow();
8899+
bool EmitEHLabels = isa<InvokeInst>(Call);
89008900
if (EmitEHLabels) {
89018901
assert(EHPadBB && "InvokeInst must have an EHPadBB");
89028902
}

llvm/lib/Transforms/Utils/InlineFunction.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,6 @@ static BasicBlock *HandleCallsInBlockInlinedThroughInvoke(
550550
if (!CI || CI->doesNotThrow())
551551
continue;
552552

553-
if (CI->isInlineAsm()) {
554-
InlineAsm *IA = cast<InlineAsm>(CI->getCalledOperand());
555-
if (!IA->canThrow()) {
556-
continue;
557-
}
558-
}
559-
560553
// We do not need to (and in fact, cannot) convert possibly throwing calls
561554
// to @llvm.experimental_deoptimize (resp. @llvm.experimental.guard) into
562555
// invokes. The caller's "segment" of the deoptimization continuation

llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-no-unwind-inline-asm.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ entry:
1616
; CHECK-LABEL: name: test
1717
; CHECK: body:
1818
; CHECK-NEXT: bb.1.entry
19-
; CHECK-NOT: EH_LABEL
19+
; CHECK: EH_LABEL
2020
; CHECK: INLINEASM
21-
; CHECK-NOT: EH_LABEL
21+
; CHECK: EH_LABEL
2222

2323
invoke void asm sideeffect "bl trap", ""()
2424
to label %invoke.cont unwind label %lpad

llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-unwind-inline-asm.ll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ define void @test2() #0 personality ptr @__gcc_personality_v0 {
6868
; CHECK-NEXT: successors: %bb.2(0x40000000), %bb.3(0x40000000)
6969
; CHECK-NEXT: {{ $}}
7070
; CHECK-NEXT: [[DEF:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
71+
; CHECK-NEXT: G_INVOKE_REGION_START
72+
; CHECK-NEXT: EH_LABEL <mcsymbol >
7173
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64common = COPY [[DEF]](p0)
7274
; CHECK-NEXT: INLINEASM &"", 1 /* sideeffect attdialect */, 2555913 /* reguse:GPR64common */, [[COPY]]
75+
; CHECK-NEXT: EH_LABEL <mcsymbol >
7376
; CHECK-NEXT: G_BR %bb.2
7477
; CHECK-NEXT: {{ $}}
7578
; CHECK-NEXT: bb.2.a:

llvm/test/CodeGen/X86/no-seh-unwind-inline-asm-codegen.ll

Lines changed: 0 additions & 58 deletions
This file was deleted.

llvm/test/CodeGen/X86/no-unwind-inline-asm-codegen.ll

Lines changed: 0 additions & 51 deletions
This file was deleted.

llvm/test/Transforms/Inline/inline-invoke-with-asm-call.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ define void @caller() personality ptr @__objc_personality_v0 {
2626
}
2727

2828
define void @callee_with_asm() {
29-
call void asm sideeffect "mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue", ""()
29+
call void asm sideeffect "mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue", ""() nounwind
3030
ret void
3131
}
3232

llvm/test/Transforms/Inline/no-unwind-inline-asm.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ entry:
1212

1313
define dso_local void @proxy() personality ptr @__gxx_personality_v0 {
1414
entry:
15-
call void asm sideeffect "call trap", "~{dirflag},~{fpsr},~{flags}"()
16-
call void asm sideeffect "call trap", "~{dirflag},~{fpsr},~{flags}"()
15+
call void asm sideeffect "call trap", "~{dirflag},~{fpsr},~{flags}"() nounwind
16+
call void asm sideeffect "call trap", "~{dirflag},~{fpsr},~{flags}"() nounwind
1717
ret void
1818
}
1919

0 commit comments

Comments
 (0)