-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[Clang] Make the AS of llvm.compiler.used & llvm.used elements addressspace(0) #164432
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
Open
jmmartinez
wants to merge
3
commits into
llvm:main
Choose a base branch
from
jmmartinez:clang/llvm_compiler_used_as_0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+45
−7
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
38 changes: 38 additions & 0 deletions
38
clang/test/CodeGen/llvm_compiler_used_elements_are_unqual.c
This file contains hidden or 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,38 @@ | ||
// RUN: %clang_cc1 -triple x86_64-- -emit-llvm -x c %s -o - \ | ||
// RUN: | FileCheck %s --check-prefix=X86 | ||
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -emit-llvm -x c %s -o - \ | ||
// RUN: | FileCheck %s --check-prefix=AMDGCN | ||
// RUN: %clang_cc1 -triple spirv64-- -emit-llvm -x c %s -o - \ | ||
// RUN: | FileCheck %s --check-prefix=SPIRV | ||
// RUN: %clang_cc1 -triple spirv64-amd-amdhsa -emit-llvm -x c %s -o - \ | ||
// RUN: | FileCheck %s --check-prefix=SPIRV_AMD | ||
|
||
static __attribute__((__used__)) int foo = 42; | ||
|
||
|
||
// X86: @foo = internal global i32 42, align 4 | ||
// X86: @llvm.compiler.used = appending global [2 x ptr] [ptr @foo, ptr @bar], section "llvm.metadata" | ||
//. | ||
// AMDGCN: @foo = internal addrspace(1) global i32 42, align 4 | ||
// AMDGCN: @llvm.compiler.used = appending addrspace(1) global [2 x ptr] [ptr addrspacecast (ptr addrspace(1) @foo to ptr), ptr @bar], section "llvm.metadata" | ||
//. | ||
// SPIRV: @foo = internal global i32 42, align 4 | ||
// SPIRV: @llvm.used = appending addrspace(1) global [2 x ptr] [ptr @foo, ptr @bar], section "llvm.metadata" | ||
//. | ||
// SPIRV_AMD: @foo = internal addrspace(1) global i32 42, align 4 | ||
// SPIRV_AMD: @llvm.used = appending addrspace(1) global [2 x ptr] [ptr addrspacecast (ptr addrspace(1) @foo to ptr), ptr addrspacecast (ptr addrspace(4) @bar to ptr)], section "llvm.metadata" | ||
//. | ||
// X86-LABEL: define internal void @bar( | ||
// X86-SAME: ) #[[ATTR0:[0-9]+]] { | ||
// | ||
// AMDGCN-LABEL: define internal void @bar( | ||
// AMDGCN-SAME: ) #[[ATTR0:[0-9]+]] { | ||
// | ||
// SPIRV-LABEL: define internal spir_func void @bar( | ||
// SPIRV-SAME: ) #[[ATTR0:[0-9]+]] { | ||
// | ||
// SPIRV_AMD-LABEL: define internal spir_func void @bar( | ||
// SPIRV_AMD-SAME: ) addrspace(4) #[[ATTR0:[0-9]+]] { | ||
// | ||
static void __attribute__((__used__)) bar() { | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.