Skip to content
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

[ClR] Set optnone attribute for functions. #115

Merged
merged 1 commit into from
Aug 15, 2023
Merged

Conversation

htyu
Copy link
Contributor

@htyu htyu commented Jun 15, 2023

Summary:
Setting the Optnone attribute for CIR functions and progating it all the way down to LLVM IR for those not supposed to be optimized.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see more attributes getting added to LLVM lowering.

clang/lib/CIR/CodeGen/CIRGenModule.cpp Outdated Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenModule.cpp Outdated Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenModule.cpp Outdated Show resolved Hide resolved
Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for driving this, more comments inline!

clang/lib/CIR/CodeGen/CIRGenModule.cpp Outdated Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenModule.cpp Outdated Show resolved Hide resolved
@bcardosolopes
Copy link
Member

There are also two spelling issues with the subject: [ClR] Set optnone attrbiute for functions

@htyu
Copy link
Contributor Author

htyu commented Aug 14, 2023

Reviving this as it's going to be used by the global ctor lowering work later.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, thanks for continuing this. Few last round of remarks

clang/include/clang/CIR/Dialect/IR/CIRAttrs.td Outdated Show resolved Hide resolved
clang/include/clang/CIR/Dialect/IR/CIRAttrs.td Outdated Show resolved Hide resolved
return x;
}

// CIR-O0: cir.func @_Z2s0ii(%arg0:{{.*}}, %arg1:{{.*}} -> {{.*}} extra( {inline = #cir.inline<no>, optnone = #cir.optnone} )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the output is:

extra( {inline = #cir.inline<no>, optnone = #cir.optnone} )

Given that the idea is to be unit-attr-like, it seems too verbose to have optnone = #cir.optnone, can we instead have (this builds on the assumption that nothing will show up if this CIRUnitAttr doesn't get created, which is how unit-attr usually works):

extra( {inline = #cir.inline<no>, #cir.optnone} )

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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



if (llvm::isa<UnitAttr>(attr.getValue()))
. 

I can think to create a subclass to override that method (will need to change it to virtual first). The parser (
attributes.push_back({*nameId, builder.getUnitAttr()});
) will need to be overriden too. Doesn’t sound trivial. 

The problem is that extra func attr is a list of named attributes, so no direct way to control how a CIR attribute is printed there. The name will always be printed first.

Summary:
Setting the Optnone attribute for CIR functions and progating it all the way down to LLVM IR for those not supposed to be optimized.
@htyu htyu merged commit edd0cfc into llvm:main Aug 15, 2023
lanza pushed a commit that referenced this pull request Oct 27, 2023
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
lanza pushed a commit that referenced this pull request Dec 20, 2023
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
lanza pushed a commit that referenced this pull request Jan 29, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
lanza pushed a commit that referenced this pull request Mar 23, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
eZWALT pushed a commit to eZWALT/clangir that referenced this pull request Mar 24, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
eZWALT pushed a commit to eZWALT/clangir that referenced this pull request Mar 24, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
lanza pushed a commit that referenced this pull request Apr 29, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
lanza pushed a commit that referenced this pull request Apr 29, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
eZWALT pushed a commit to eZWALT/clangir that referenced this pull request Apr 29, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
lanza pushed a commit that referenced this pull request Apr 29, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
bruteforceboy pushed a commit to bruteforceboy/clangir that referenced this pull request Oct 2, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
lanza pushed a commit that referenced this pull request Nov 5, 2024
Summary:
Setting the Optnone attribute for CIR functions and progating it all the
way down to LLVM IR for those not supposed to be optimized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants