Skip to content

[EHStreamer] nounwind on call-sites and builtins is ignored #107195

Open
@nikic

Description

@nikic

https://llvm.godbolt.org/z/4hhf36Wf8

declare void @personality()

declare void @nounwind_decl() nounwind
declare void @nounwind_call()

define void @test_nounwind_decl() personality ptr @personality {
  call void @nounwind_decl()
  ret void
}

define void @test_nounwind_call() personality ptr @personality {
  call void @nounwind_call() nounwind
  ret void
}

define void @test_memset(ptr %p) personality ptr @personality {
  call void @llvm.memset(ptr %p, i8 0, i64 1000, i1 false)
  ret void
}

In this example, the gcc_except_table section for test_nounwind_decl does not contain information about the call (as the declaration is nounwind), but the sections for test_nounwind_call and test_memset do contain it.

This is because

bool EHStreamer::callToNoUnwindFunction(const MachineInstr *MI) {
looks at the attributes of a Function operand of the call. This does not work if the call-site was marked nounwind, or if it's a libcall lowering, e.g. of an intrinsic.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions