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

[CIR][ABI] Apply CC lowering pass by default #842

Merged

Conversation

sitio-couto
Copy link
Collaborator

Before this patch, the CC lowering pass was applied only when explicitly requested by the user. This update changes the default behavior to always apply the CC lowering pass, with an option to disable it using the -fno-clangir-call-conv-lowering flag if necessary.

The primary objective is to make this pass a mandatory step in the compilation pipeline. This ensures that future contributions correctly implement the CC lowering for both existing and new targets, resulting in more consistent and accurate code generation.

From an implementation perspective, several llvm_unreachable statements have been substituted with a new assert_or_abort macro. This macro can be configured to either trigger a non-blocking assertion or a blocking unreachable statement. This facilitates a test-by-testa incremental development as it does not required you to know which code path a test will trigger an just cause a crash if it does.

A few notable changes:

  • Support multi-block function in CC lowering
  • Ignore pointer-related CC lowering
  • Ignore no-proto functions CC lowering
  • Handle missing type evaluation kinds
  • Fix CC lowering for function declarations
  • Unblock indirect function calls
  • Disable CC lowering pass on several tests

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 a bunch for working on this. Mostly nits in this round but approach LGTM (will merge once fixed)

clang/include/clang/CIR/MissingFeatures.h Outdated Show resolved Hide resolved
clang/include/clang/CIR/MissingFeatures.h Outdated Show resolved Hide resolved
clang/include/clang/Driver/Options.td Show resolved Hide resolved
@bcardosolopes
Copy link
Member

There are formatting changes needed, but for tests seems like you are hitting #829, so feel free to ignore that one.

@bcardosolopes
Copy link
Member

Conflicts + some tests failing still (probably because of recent merges).

Before this patch, the CC lowering pass was applied only when explicitly
requested by the user. This update changes the default behavior to
always apply the CC lowering pass, with an option to disable it using
the `-fno-clangir-call-conv-lowering` flag if necessary.

The primary objective is to make this pass a mandatory step in the
compilation pipeline. This ensures that future contributions correctly
implement the CC lowering for both existing and new targets, resulting
in more consistent and accurate code generation.

From an implementation perspective, several `llvm_unreachable`
statements have been substituted with a new `assert_or_abort` macro.
This macro can be configured to either trigger a non-blocking assertion
or a blocking unreachable statement. This facilitates a test-by-testa
incremental development as it does not required you to know which
code path a test will trigger an just cause a crash if it does.

A few notable changes:

 - Support multi-block function in CC lowering
 - Ignore pointer-related CC lowering
 - Ignore no-proto functions CC lowering
 - Handle missing type evaluation kinds
 - Fix CC lowering for function declarations
 - Unblock indirect function calls
 - Disable CC lowering pass on several tests
@sitio-couto sitio-couto force-pushed the vinicius/run-cc-lowering-by-default branch from c748b22 to 21e78b1 Compare September 21, 2024 10:13
@sitio-couto
Copy link
Collaborator Author

@bcardosolopes applied.

@sitio-couto
Copy link
Collaborator Author

@bcardosolopes applied.

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.

LGTM, I'll land this tomorrow, so I'll apply a similar change downstream to disable this flag, sorry for the delay

@bcardosolopes bcardosolopes merged commit db6b7c0 into llvm:main Sep 28, 2024
6 checks passed
@sitio-couto sitio-couto deleted the vinicius/run-cc-lowering-by-default branch September 28, 2024 19:11
bcardosolopes added a commit that referenced this pull request Sep 30, 2024
Fix #895 and it's also missing some more
throughout behavior for the pass, it also needs to be enabled by default when
emitting object files.

This reverts commit db6b7c0.
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
Before this patch, the CC lowering pass was applied only when explicitly
requested by the user. This update changes the default behavior to
always apply the CC lowering pass, with an option to disable it using
the `-fno-clangir-call-conv-lowering` flag if necessary.

The primary objective is to make this pass a mandatory step in the
compilation pipeline. This ensures that future contributions correctly
implement the CC lowering for both existing and new targets, resulting
in more consistent and accurate code generation.

From an implementation perspective, several `llvm_unreachable`
statements have been substituted with a new `assert_or_abort` macro.
This macro can be configured to either trigger a non-blocking assertion
or a blocking unreachable statement. This facilitates a test-by-testa
incremental development as it does not required you to know which code
path a test will trigger an just cause a crash if it does.

A few notable changes:

 - Support multi-block function in CC lowering
 - Ignore pointer-related CC lowering
 - Ignore no-proto functions CC lowering
 - Handle missing type evaluation kinds
 - Fix CC lowering for function declarations
 - Unblock indirect function calls
 - Disable CC lowering pass on several tests
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
Fix llvm#895 and it's also missing some more
throughout behavior for the pass, it also needs to be enabled by default when
emitting object files.

This reverts commit db6b7c0.
sitio-couto added a commit to sitio-couto/clangir that referenced this pull request Oct 7, 2024
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Before this patch, the CC lowering pass was applied only when explicitly
requested by the user. This update changes the default behavior to
always apply the CC lowering pass, with an option to disable it using
the `-fno-clangir-call-conv-lowering` flag if necessary.

The primary objective is to make this pass a mandatory step in the
compilation pipeline. This ensures that future contributions correctly
implement the CC lowering for both existing and new targets, resulting
in more consistent and accurate code generation.

From an implementation perspective, several `llvm_unreachable`
statements have been substituted with a new `assert_or_abort` macro.
This macro can be configured to either trigger a non-blocking assertion
or a blocking unreachable statement. This facilitates a test-by-testa
incremental development as it does not required you to know which code
path a test will trigger an just cause a crash if it does.

A few notable changes:

 - Support multi-block function in CC lowering
 - Ignore pointer-related CC lowering
 - Ignore no-proto functions CC lowering
 - Handle missing type evaluation kinds
 - Fix CC lowering for function declarations
 - Unblock indirect function calls
 - Disable CC lowering pass on several tests
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Fix llvm#895 and it's also missing some more
throughout behavior for the pass, it also needs to be enabled by default when
emitting object files.

This reverts commit db6b7c0.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Before this patch, the CC lowering pass was applied only when explicitly
requested by the user. This update changes the default behavior to
always apply the CC lowering pass, with an option to disable it using
the `-fno-clangir-call-conv-lowering` flag if necessary.

The primary objective is to make this pass a mandatory step in the
compilation pipeline. This ensures that future contributions correctly
implement the CC lowering for both existing and new targets, resulting
in more consistent and accurate code generation.

From an implementation perspective, several `llvm_unreachable`
statements have been substituted with a new `assert_or_abort` macro.
This macro can be configured to either trigger a non-blocking assertion
or a blocking unreachable statement. This facilitates a test-by-testa
incremental development as it does not required you to know which code
path a test will trigger an just cause a crash if it does.

A few notable changes:

 - Support multi-block function in CC lowering
 - Ignore pointer-related CC lowering
 - Ignore no-proto functions CC lowering
 - Handle missing type evaluation kinds
 - Fix CC lowering for function declarations
 - Unblock indirect function calls
 - Disable CC lowering pass on several tests
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Fix llvm#895 and it's also missing some more
throughout behavior for the pass, it also needs to be enabled by default when
emitting object files.

This reverts commit db6b7c0.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Before this patch, the CC lowering pass was applied only when explicitly
requested by the user. This update changes the default behavior to
always apply the CC lowering pass, with an option to disable it using
the `-fno-clangir-call-conv-lowering` flag if necessary.

The primary objective is to make this pass a mandatory step in the
compilation pipeline. This ensures that future contributions correctly
implement the CC lowering for both existing and new targets, resulting
in more consistent and accurate code generation.

From an implementation perspective, several `llvm_unreachable`
statements have been substituted with a new `assert_or_abort` macro.
This macro can be configured to either trigger a non-blocking assertion
or a blocking unreachable statement. This facilitates a test-by-testa
incremental development as it does not required you to know which code
path a test will trigger an just cause a crash if it does.

A few notable changes:

 - Support multi-block function in CC lowering
 - Ignore pointer-related CC lowering
 - Ignore no-proto functions CC lowering
 - Handle missing type evaluation kinds
 - Fix CC lowering for function declarations
 - Unblock indirect function calls
 - Disable CC lowering pass on several tests
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Fix llvm#895 and it's also missing some more
throughout behavior for the pass, it also needs to be enabled by default when
emitting object files.

This reverts commit db6b7c0.
sitio-couto added a commit to sitio-couto/clangir that referenced this pull request Oct 10, 2024
bcardosolopes pushed a commit that referenced this pull request Oct 11, 2024
…" (#944)

This reverts commit 8f699fd and fixes some issues, namely:
 
- CC lowering pass will no longer fail if the function has no AST
information that won't be used.
- Fixed CC lowering not disabling when running certain `cc1` compilation
commands.
- CC lowering can now be disabled when calling `cir-opt` and
`cir-translate`.
- Compilation commands that generate Object files should now invoke CC
lowering by default.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
Before this patch, the CC lowering pass was applied only when explicitly
requested by the user. This update changes the default behavior to
always apply the CC lowering pass, with an option to disable it using
the `-fno-clangir-call-conv-lowering` flag if necessary.

The primary objective is to make this pass a mandatory step in the
compilation pipeline. This ensures that future contributions correctly
implement the CC lowering for both existing and new targets, resulting
in more consistent and accurate code generation.

From an implementation perspective, several `llvm_unreachable`
statements have been substituted with a new `assert_or_abort` macro.
This macro can be configured to either trigger a non-blocking assertion
or a blocking unreachable statement. This facilitates a test-by-testa
incremental development as it does not required you to know which code
path a test will trigger an just cause a crash if it does.

A few notable changes:

 - Support multi-block function in CC lowering
 - Ignore pointer-related CC lowering
 - Ignore no-proto functions CC lowering
 - Handle missing type evaluation kinds
 - Fix CC lowering for function declarations
 - Unblock indirect function calls
 - Disable CC lowering pass on several tests
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
Fix llvm#895 and it's also missing some more
throughout behavior for the pass, it also needs to be enabled by default when
emitting object files.

This reverts commit db6b7c0.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
…#842)" (llvm#944)

This reverts commit 8f699fd and fixes some issues, namely:
 
- CC lowering pass will no longer fail if the function has no AST
information that won't be used.
- Fixed CC lowering not disabling when running certain `cc1` compilation
commands.
- CC lowering can now be disabled when calling `cir-opt` and
`cir-translate`.
- Compilation commands that generate Object files should now invoke CC
lowering by default.
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.

2 participants