-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[RegAlloc] Fix the terminal rule check for interfere with DstReg #168661
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
base: main
Are you sure you want to change the base?
Conversation
|
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-llvm-regalloc Author: None (hstk30-hw) ChangesThis maybe a bug which is introduced by commit 6749ae3, and has been present ever since. Full diff: https://github.com/llvm/llvm-project/pull/168661.diff 1 Files Affected:
diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp
index 25c4375a73ce0..e624088a0964e 100644
--- a/llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -4150,7 +4150,7 @@ bool RegisterCoalescer::applyTerminalRule(const MachineInstr &Copy) const {
continue;
Register OtherSrcReg, OtherReg;
unsigned OtherSrcSubReg = 0, OtherSubReg = 0;
- if (!isMoveInstr(*TRI, &Copy, OtherSrcReg, OtherReg, OtherSrcSubReg,
+ if (!isMoveInstr(*TRI, &MI, OtherSrcReg, OtherReg, OtherSrcSubReg,
OtherSubReg))
return false;
if (OtherReg == SrcReg)
|
|
There are many testcases fail, so if this is right, then I will fix and update it. |
|
The fix looks intuitively correct to me |
qcolombet
left a comment
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.
Great catch @hstk30-hw!
Do you have a test case that exercises this problem.
|
Fix all failed testcase. |
🐧 Linux x64 Test Results
|
Not for now :) I see luke get a nice performance improvement on MiBench with a 17% reduction in dynamic instruction count. |
I think @qcolombet meant a mir lit test which shows the change, not benchmark results |
This maybe a bug which is introduced by commit 6749ae3, and has been present ever since.
In this case,
OtherRegalways overlaps withDstRegcause they from theCopyall.