-
Notifications
You must be signed in to change notification settings - Fork 183
[ClR] Set optnone attribute for functions. #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,25 @@ | ||||||
| // RUN: %clang_cc1 -O0 -triple x86_64-unknown-linux-gnu -fclangir-enable -emit-cir %s -o %t.cir | ||||||
| // RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR-O0 | ||||||
| // RUN: %clang_cc1 -O0 -triple x86_64-unknown-linux-gnu -fclangir-enable -emit-llvm %s -o %t.ll | ||||||
| // RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM-O0 | ||||||
|
|
||||||
| // RUN: %clang_cc1 -O2 -triple x86_64-unknown-linux-gnu -fclangir-enable -emit-cir %s -o %t2.cir | ||||||
| // RUN: FileCheck --input-file=%t2.cir %s -check-prefix=CIR-O2 | ||||||
| // RUN: %clang_cc1 -O2 -triple x86_64-unknown-linux-gnu -fclangir-enable -emit-llvm %s -o %t2.ll | ||||||
| // RUN: FileCheck --input-file=%t2.ll %s -check-prefix=LLVM-O2 | ||||||
|
|
||||||
| int s0(int a, int b) { | ||||||
| int x = a + b; | ||||||
| if (x > 0) | ||||||
| x = 0; | ||||||
| else | ||||||
| x = 1; | ||||||
| return x; | ||||||
| } | ||||||
|
|
||||||
| // CIR-O0: cir.func @_Z2s0ii(%arg0:{{.*}}, %arg1:{{.*}} -> {{.*}} extra( {inline = #cir.inline<no>, optnone = #cir.optnone} ) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see the output is:
Given that the idea is to be unit-attr-like, it seems too verbose to have
?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Talked offline. It looks like MLIR has a hack that only works for the MLIR UnitAttr clangir/mlir/lib/IR/AsmPrinter.cpp Line 2584 in 8e37695
|
||||||
| // CIR-O2-NOT: cir.func @_Z2s0ii(%arg0:{{.*}}, %arg1:{{.*}} -> {{.*}} optnone | ||||||
|
|
||||||
| // LLVM-O0: define i32 @_Z2s0ii(i32 %0, i32 %1) #[[#ATTR:]] | ||||||
| // LLVM-O0: attributes #[[#ATTR]] = { noinline optnone } | ||||||
| // LLVM-O2-NOT: attributes #[[#]] = { noinline optnone } | ||||||
Uh oh!
There was an error while loading. Please reload this page.