Skip to content

Commit ca7b65c

Browse files
committed
Do not allow to ignore code generation instr. after a __attribute__((noreturn)) call in task context
Closes llvm#40
1 parent 6219954 commit ca7b65c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

clang/lib/CodeGen/CGCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4409,7 +4409,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
44094409
// If the call doesn't return, finish the basic block and clear the
44104410
// insertion point; this allows the rest of IRGen to discard
44114411
// unreachable code.
4412-
if (CI->doesNotReturn()) {
4412+
if (CI->doesNotReturn() && !getLangOpts().OmpSs) {
44134413
if (UnusedReturnSizePtr)
44144414
PopCleanupBlock();
44154415

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %clang_cc1 -verify -fompss-2 -disable-llvm-passes -ferror-limit 100 %s -S -emit-llvm -o - | FileCheck %s
2+
// expected-no-diagnostics
3+
4+
__attribute__((noreturn)) void foo();
5+
int main() {
6+
#pragma oss task
7+
{
8+
foo();
9+
}
10+
}
11+
12+
// CHECK: %0 = call token @llvm.directive.region.entry() [ "DIR.OSS"([5 x i8] c"TASK\00") ]
13+
// CHECK-NEXT: call void (...) @foo()
14+
// CHECK-NEXT: call void @llvm.directive.region.exit(token %0)
15+
// CHECK-NEXT: ret i32 0
16+

0 commit comments

Comments
 (0)