-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "[OpenMP] Remove noinline attributes in the device runtime"
The behaviour of this patch is not great, but it has some side-effects that are required for OpenMPOpt to work. The problem is that when we use `-mlink-builtin-bitcode` we only import used symbols from the runtime. Then OpenMPOpt will insert calls to symbols that were not previously included. This patch removed this implicit behaviour as these functions were kept alive by the `noinline` simply because it kept calls to them in the module. This caused regression in some tests that relied on some OpenMPOpt passes without using LTO. Reverting for the LLVM15 release but will try to fix it more correctly on main. This reverts commit d61d72d. Fixes #56752
- Loading branch information
Showing
7 changed files
with
127 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes | ||
; RUN: opt < %s -S -openmp-opt-cgscc | FileCheck %s | ||
; RUN: opt < %s -S -passes=openmp-opt-cgscc | FileCheck %s | ||
|
||
declare void @unknown() | ||
|
||
; __kmpc functions | ||
define void @__kmpc_noinline() noinline nounwind { | ||
; CHECK: Function Attrs: nounwind | ||
; CHECK-LABEL: @__kmpc_noinline( | ||
; CHECK-NEXT: call void @unknown() | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @unknown() | ||
ret void | ||
} | ||
; omp_X functions | ||
define void @omp_noinline() noinline nounwind { | ||
; CHECK: Function Attrs: nounwind | ||
; CHECK-LABEL: @omp_noinline( | ||
; CHECK-NEXT: call void @unknown() | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @unknown() | ||
ret void | ||
} | ||
; _OMP namespace | ||
define void @_ZN4_OMP_noinline() noinline nounwind { | ||
; CHECK: Function Attrs: nounwind | ||
; CHECK-LABEL: @_ZN4_OMP_noinline( | ||
; CHECK-NEXT: call void @unknown() | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @unknown() | ||
ret void | ||
} | ||
|
||
; Negative tests: | ||
|
||
define void @__kmpc_noinline_optnone() noinline optnone nounwind { | ||
; CHECK: Function Attrs: noinline nounwind optnone | ||
; CHECK-LABEL: @__kmpc_noinline_optnone( | ||
; CHECK-NEXT: call void @unknown() | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @unknown() | ||
ret void | ||
} | ||
define void @omp_noinline_optnone() noinline optnone nounwind { | ||
; CHECK: Function Attrs: noinline nounwind optnone | ||
; CHECK-LABEL: @omp_noinline_optnone( | ||
; CHECK-NEXT: call void @unknown() | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @unknown() | ||
ret void | ||
} | ||
; _OMP namespace | ||
define void @_ZN4_OMP_noinline_optnone() noinline optnone nounwind { | ||
; CHECK: Function Attrs: noinline nounwind optnone | ||
; CHECK-LABEL: @_ZN4_OMP_noinline_optnone( | ||
; CHECK-NEXT: call void @unknown() | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @unknown() | ||
ret void | ||
} | ||
define void @a___kmpc_noinline() noinline nounwind { | ||
; CHECK: Function Attrs: noinline nounwind | ||
; CHECK-LABEL: @a___kmpc_noinline( | ||
; CHECK-NEXT: call void @unknown() | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @unknown() | ||
ret void | ||
} | ||
define void @a_omp_noinline() noinline nounwind { | ||
; CHECK: Function Attrs: noinline nounwind | ||
; CHECK-LABEL: @a_omp_noinline( | ||
; CHECK-NEXT: call void @unknown() | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @unknown() | ||
ret void | ||
} | ||
define void @a__ZN4_OMP_noinline() noinline nounwind { | ||
; CHECK: Function Attrs: noinline nounwind | ||
; CHECK-LABEL: @a__ZN4_OMP_noinline( | ||
; CHECK-NEXT: call void @unknown() | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @unknown() | ||
ret void | ||
} | ||
|
||
!llvm.module.flags = !{!0, !1} | ||
|
||
!0 = !{i32 7, !"openmp", i32 50} | ||
!1 = !{i32 7, !"openmp-device", i32 50} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters