-
Notifications
You must be signed in to change notification settings - Fork 15k
[BranchRelaxation] Fix invalid branch generation in branch-relaxation #162065
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
|
||
| # RUN: llc %s -mtriple=riscv64 -run-pass=branch-relaxation -o - -verify-machineinstrs | FileCheck %s | ||
|
|
||
| --- | | ||
| define void @foo() { | ||
| ret void | ||
| } | ||
| ... | ||
| --- | ||
| name: foo | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| liveins: $x1 | ||
| BNE $x1, $x0, %bb.3 | ||
| PseudoBR %bb.3 | ||
| bb.1: | ||
| liveins: $x1 | ||
| INLINEASM &".space 4096", 1 | ||
| BGE $x1, $x0, %bb.3 | ||
| bb.3: | ||
| PseudoRET | ||
| ## NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: | ||
| # CHECK: {{.*}} | ||
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.
For RISC-V, this seems correct.
I'm not entirely sure if we should be using a sequence of
removeBranch(MBB); insertUncondBranch(MBB, TBB)instead of just removing one instruction, not being familiar with how all the targets defineremoveBranchandinsertUnconditionalBranch. From the few I reviewed, they mostly do seem straightforward, but that's not guaranteed?Uh oh!
There was an error while loading. Please reload this page.
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.
I am also not entirely sure about all the targets, but looking at functions description inside TargetInstrInfo.h seems like these functions are indeed pretty straightforward. Lets this sequence instead of explicit
eraseFromParentlike in other parts of this pass.