Skip to content

Commit e2654d4

Browse files
Emit "unreachable" instruction if a function does not return for non-sycl devices
1 parent b7c8345 commit e2654d4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

clang/lib/CodeGen/CGCall.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4988,10 +4988,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
49884988

49894989
// 4. Finish the call.
49904990

4991-
// If the call doesn't return, finish the basic block and clear the
4991+
// If the call doesn't return for non-sycl devices, finish the basic block and clear the
49924992
// insertion point; this allows the rest of IRGen to discard
49934993
// unreachable code.
4994-
if (CI->doesNotReturn()) {
4994+
if (CI->doesNotReturn() && !getLangOpts().SYCLIsDevice) {
49954995
if (UnusedReturnSizePtr)
49964996
PopCleanupBlock();
49974997

@@ -5017,9 +5017,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
50175017
EmitNounwindRuntimeCall(Fn);
50185018
}
50195019
}
5020-
// Emit unreachable only for non-sycl devices
5021-
if (!getLangOpts().SYCLIsDevice)
5022-
EmitUnreachable(Loc);
5020+
5021+
EmitUnreachable(Loc);
50235022
Builder.ClearInsertionPoint();
50245023

50255024
// FIXME: For now, emit a dummy basic block because expr emitters in

0 commit comments

Comments
 (0)