forked from llvm/clangir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CIR][CodeGen] Add
nothrow
for functions in OpenCL languages (llvm#903
) Heterogeneous languages do not support exceptions, which corresponds to `nothrow` in ClangIR and `nounwind` in LLVM IR. This PR adds nothrow attributes for all functions for OpenCL languages in CIRGen. The Lowering for it is already supported previously.
- Loading branch information
1 parent
ccdc2ff
commit d9c1133
Showing
3 changed files
with
38 additions
and
3 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
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,26 @@ | ||
// RUN: %clang_cc1 -fclangir -triple=spirv64-unknown-unknown -emit-cir -o %t.cir %s | ||
// RUN: FileCheck %s -input-file=%t.cir -check-prefixes CIR | ||
// RUN: %clang_cc1 -fclangir -triple=spirv64-unknown-unknown -emit-llvm -o %t.ll %s | ||
// RUN: FileCheck %s -input-file=%t.ll -check-prefixes LLVM | ||
|
||
// CIR-LABEL: #fn_attr = | ||
// CIR: cl.kernel = #cir.cl.kernel | ||
// CIR: nothrow = #cir.nothrow | ||
|
||
// CIR-LABEL: #fn_attr1 = | ||
// CIR-NOT: cl.kernel = #cir.cl.kernel | ||
// CIR: nothrow = #cir.nothrow | ||
|
||
kernel void ker() {}; | ||
// CIR: cir.func @ker{{.*}} extra(#fn_attr) { | ||
// LLVM: define{{.*}}@ker(){{.*}} #0 | ||
|
||
void foo() {}; | ||
// CIR: cir.func @foo{{.*}} extra(#fn_attr1) { | ||
// LLVM: define{{.*}}@foo(){{.*}} #1 | ||
|
||
// LLVM-LABEL: attributes #0 | ||
// LLVM: nounwind | ||
|
||
// LLVM-LABEL: attributes #1 | ||
// LLVM: nounwind |