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][FrontendAction] Use ClangIR pipeline to emit LLVM bitcode #782

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

seven-mile
Copy link
Collaborator

This PR enables ClangIR pipeline for LLVM bitcode output when it's specified properly, aligned with the behavior of text-form LLVM IR.

Some refactors about switch cases are also included to avoid too many dups.

@@ -2,6 +2,9 @@
// RUN: FileCheck --input-file=%t.mlir %s -check-prefix=MLIR
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm-bc %s -o %t.bc
// RUN: llvm-dis %t.bc -o %t.bc.ll
// RUN: FileCheck --input-file=%t.bc.ll %s -check-prefix=LLVM
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Intentionally use the same check prefix to ensure that bitcode is equally exercised by check lines.

@@ -364,6 +356,8 @@ getOutputStream(CompilerInstance &ci, StringRef inFile,
return ci.createDefaultOutputFile(false, inFile, "mlir");
case CIRGenAction::OutputType::EmitLLVM:
return ci.createDefaultOutputFile(false, inFile, "llvm");
case CIRGenAction::OutputType::EmitBC:
return ci.createDefaultOutputFile(true, inFile, "bc");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

/*binary=*/true, similar to EmitObj.

Comment on lines +277 to +280
case CIRGenAction::OutputType::EmitLLVM:
case CIRGenAction::OutputType::EmitBC:
case CIRGenAction::OutputType::EmitObj:
case CIRGenAction::OutputType::EmitAssembly: {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

3+1 dup cases are merged.

@bcardosolopes bcardosolopes merged commit 60214e0 into llvm:main Aug 9, 2024
7 checks passed
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
…#782)

This PR enables ClangIR pipeline for LLVM bitcode output when it's
specified properly, aligned with the behavior of text-form LLVM IR.

Some refactors about switch cases are also included to avoid too many
dups.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
…#782)

This PR enables ClangIR pipeline for LLVM bitcode output when it's
specified properly, aligned with the behavior of text-form LLVM IR.

Some refactors about switch cases are also included to avoid too many
dups.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
…#782)

This PR enables ClangIR pipeline for LLVM bitcode output when it's
specified properly, aligned with the behavior of text-form LLVM IR.

Some refactors about switch cases are also included to avoid too many
dups.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
…#782)

This PR enables ClangIR pipeline for LLVM bitcode output when it's
specified properly, aligned with the behavior of text-form LLVM IR.

Some refactors about switch cases are also included to avoid too many
dups.
lanza pushed a commit that referenced this pull request Nov 5, 2024
This PR enables ClangIR pipeline for LLVM bitcode output when it's
specified properly, aligned with the behavior of text-form LLVM IR.

Some refactors about switch cases are also included to avoid too many
dups.
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