-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[IR] llvm.reloc.none intrinsic for no-op symbol references #147427
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
mysterymath
wants to merge
13
commits into
main
Choose a base branch
from
users/mysterymath/modular-printf/reloc.none
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.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
383bd60
[IR] llvm.reloc.none intrinsic for no-op symbol references
mysterymath cd94463
fake.use -> reloc.none
mysterymath a045626
Take symbol name by metadata arg rather than ptr to GlobalValue
mysterymath f439cb6
Add a generic reloc_none test
mysterymath 312f688
IR verifier check and test
mysterymath 5d2bb5e
Remove unneeded assertion from AsmPrinter
mysterymath f67a868
Use llvm-as for test
mysterymath eac2e30
Rename reloc_none.ll to reloc-none.ll
mysterymath d4b5316
Lower reloc.none in Global ISel
mysterymath 2d891ba
Remove arg from emitRelocDirective call
mysterymath 984b060
Update tests
mysterymath ccafe0c
Take symbol name by GlobalValue again to avoid modifying Module
mysterymath bad31c7
Update big-filter.td
mysterymath 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
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
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
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
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 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7750,6 +7750,17 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, | |||||||||||||||||
return; | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
case Intrinsic::reloc_none: { | ||||||||||||||||||
SDValue V = getValue(I.getArgOperand(0)); | ||||||||||||||||||
const auto *GA = cast<GlobalAddressSDNode>(V); | ||||||||||||||||||
SDValue Ops[2]; | ||||||||||||||||||
Ops[0] = getRoot(); | ||||||||||||||||||
Ops[1] = DAG.getTargetGlobalAddress(GA->getGlobal(), sdl, V.getValueType(), | ||||||||||||||||||
GA->getOffset()); | ||||||||||||||||||
Comment on lines
+7756
to
+7759
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.
Suggested change
|
||||||||||||||||||
DAG.setRoot(DAG.getNode(ISD::RELOC_NONE, sdl, MVT::Other, Ops)); | ||||||||||||||||||
return; | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
case Intrinsic::eh_exceptionpointer: | ||||||||||||||||||
case Intrinsic::eh_exceptioncode: { | ||||||||||||||||||
// Get the exception pointer vreg, copy from it, and resize it to fit. | ||||||||||||||||||
|
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
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
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,13 @@ | ||
; RUN: llc < %s | FileCheck %s | ||
|
||
; CHECK: .reloc {{.*}}, BFD_RELOC_NONE, foo | ||
|
||
%1 = type opaque | ||
@foo = external global %1 | ||
|
||
define void @test_reloc_none() { | ||
call void @llvm.reloc.none(ptr @foo) | ||
ret void | ||
} | ||
|
||
declare void @llvm.reloc.none(ptr) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=CHECK | ||
|
||
%1 = type opaque | ||
@foo = external global %1 | ||
|
||
define void @test_reloc_none() { | ||
; CHECK-LABEL: test_reloc_none: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: .Lreloc_none0: | ||
; CHECK-NEXT: .reloc .Lreloc_none0, BFD_RELOC_NONE, foo | ||
; CHECK-NEXT: retq | ||
call void @llvm.reloc.none(ptr @foo) | ||
ret void | ||
} | ||
|
||
declare void @llvm.reloc.none(ptr) |
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
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,13 @@ | ||
; RUN: not llvm-as -disable-output 2>&1 %s | FileCheck %s | ||
|
||
; CHECK: llvm.reloc.none argument must be a global value | ||
; CHECK-NEXT: call void @llvm.reloc.none(ptr %foo) | ||
|
||
define void @test_reloc_none_bad_arg(ptr %foo) { | ||
call void @llvm.reloc.none(ptr %foo) | ||
ret void | ||
} | ||
|
||
declare void @llvm.reloc.none(ptr) | ||
|
||
!0 = !{} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why define IntrHasSideEffects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New uses of llvm_ptr_ty should not be introduced. Only llvm_anyptr_ty