-
Notifications
You must be signed in to change notification settings - Fork 15k
LoongArch: Improve detection of valid TripleABI #147952
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
Conversation
|
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
|
@llvm/pr-subscribers-backend-loongarch Author: None (mintsuki) ChangesAddresses issue #147665 Full diff: https://github.com/llvm/llvm-project/pull/147952.diff 1 Files Affected:
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp
index 03ce004ed33a5..d21c996704544 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp
@@ -62,9 +62,11 @@ static ABI getTripleABI(const Triple &TT) {
break;
// Let the fallback case behave like {ILP32,LP64}D.
case llvm::Triple::EnvironmentType::GNUF64:
- default:
TripleABI = Is64Bit ? ABI_LP64D : ABI_ILP32D;
break;
+ default:
+ TripleABI = ABI_Unknown;
+ break;
}
return TripleABI;
}
@@ -96,7 +98,7 @@ ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits,
// 1. If the '-target-abi' is valid, use it.
if (IsABIValidForFeature(ArgProvidedABI)) {
- if (TT.hasEnvironment() && ArgProvidedABI != TripleABI)
+ if (IsABIValidForFeature(TripleABI) && ArgProvidedABI != TripleABI)
errs()
<< "warning: triple-implied ABI conflicts with provided target-abi '"
<< ABIName << "', using target-abi\n";
|
a481cb3 to
34376af
Compare
|
Thanks for the report and patch. Could you please
|
@MaskRay I updated the description, but I am not sure what to change in the |
|
Add a run line like |
This warning does not return 1 with |
|
|
@zhaoqi5 okay, but how would I check that a warning is not generated? Can you please propose a change? |
I think we can delete the check directly. But it is better to find a case that still appears this warning. By the way, I accidentally found that your changes seem to have unwanted influence to But no warnings without your commit. I think this should be dealt with. |
|
I cannot reproduce those warnings, either with, or without my changes. |
436c35b to
54a136f
Compare
|
Okay, I made the test pass, now. I modified my change such that if a |
72ec69a to
f8a753f
Compare
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.
Approved on my end. Please wait for a LoongArch maintainer's approval.
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.
LGTM. But I suggest to keep it open for a couple of days in case other people have any comments.
|
If the triple environment type is unknown ( ie. using I donot know whether the warnings should be avoided. |
If the environment is considered to be the final triple component as a whole, then the loongarch64 function computeTargetABI() should be changed not to rely on hasEnvironment(), but, rather, to check if there is a non-unknown environment set. Without this change, using a (ideally valid) target of loongarch64-unknown-none-elf, with a manually specified ABI of lp64s, will result in a completely superfluous warning: warning: triple-implied ABI conflicts with provided target-abi 'lp64s', using target-abi
f8a753f to
ba2dcbe
Compare
Seems reasonable, I have updated the PR accordingly, thanks. |
|
Will this PR make its way into 21.x? Would be nice if it could, since it's a rather small fix that prevents a lot of spurious warnings with the |
|
@MaskRay CI needs approval after my last force push. |
I think it can be cherry-picked to 21.x. |
|
Awesome! Thanks. |
|
@mintsuki Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
|
/cherry-pick 9ed8816 |
|
/pull-request #149961 |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/186/builds/10923 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/14560 Here is the relevant piece of the build log for the reference |
If the environment is considered to be the triple component as a whole, so, including the object format, if any, and if that is the intended behaviour, then the loongarch64 function `computeTargetABI()` should be changed to not rely on `hasEnvironment()`, but, rather, to check if there is a non-unknown environment set. Without this change, using a (ideally valid) target of loongarch64-unknown-none-elf, with a manually specified ABI of lp64s, will result in a completely superfluous warning: ``` warning: triple-implied ABI conflicts with provided target-abi 'lp64s', using target-abi ``` (cherry picked from commit 9ed8816)
|
Hi, it looks like this PR broke a few buildbots. e.g., Can you take a look? |
This reverts commit 9ed8816.
Seems these failures were not caused by this change. And the buildbots are green now. |
If the environment is considered to be the triple component as a whole, so, including the object format, if any, and if that is the intended behaviour, then the loongarch64 function `computeTargetABI()` should be changed to not rely on `hasEnvironment()`, but, rather, to check if there is a non-unknown environment set. Without this change, using a (ideally valid) target of loongarch64-unknown-none-elf, with a manually specified ABI of lp64s, will result in a completely superfluous warning: ``` warning: triple-implied ABI conflicts with provided target-abi 'lp64s', using target-abi ```
If the environment is considered to be the triple component as a whole, so, including the object format, if any, and if that is the intended behaviour, then the loongarch64 function
computeTargetABI()should be changed to not rely onhasEnvironment(), but, rather, to check if there is a non-unknown environment set.Without this change, using a (ideally valid) target of loongarch64-unknown-none-elf, with a manually specified ABI of lp64s, will result in a completely superfluous warning: