-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[GISel] Add generic implementation for @llvm.expect.with.probability when optimizations are disabled #117835
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
[GISel] Add generic implementation for @llvm.expect.with.probability when optimizations are disabled #117835
Conversation
…when optimizations are disabled Handle @llvm.expect.with.probability in GlobalISel in the same way @llvm.expect is handled, passing the value through as-is. This can be encountered if the intrinsic is used without optimizations, which would otherwise transform it out.
@llvm/pr-subscribers-backend-aarch64 @llvm/pr-subscribers-llvm-globalisel Author: None (antangelo) ChangesHandle @llvm.expect.with.probability in GlobalISel in the same way @llvm.expect is handled, passing the value through as-is. This can be encountered if the intrinsic is used without optimizations, which would otherwise transform it out. Fixes #115411 for GlobalISel Full diff: https://github.com/llvm/llvm-project/pull/117835.diff 2 Files Affected:
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 675f55d8086bc3..f668e41094bbc8 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -2431,6 +2431,7 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
case Intrinsic::invariant_end:
return true;
case Intrinsic::expect:
+ case Intrinsic::expect_with_probability:
case Intrinsic::annotation:
case Intrinsic::ptr_annotation:
case Intrinsic::launder_invariant_group:
diff --git a/llvm/test/CodeGen/Generic/builtin-expect-with-probability.ll b/llvm/test/CodeGen/Generic/builtin-expect-with-probability.ll
index aef134b636d5a7..76e9e5e81aae0f 100644
--- a/llvm/test/CodeGen/Generic/builtin-expect-with-probability.ll
+++ b/llvm/test/CodeGen/Generic/builtin-expect-with-probability.ll
@@ -1,4 +1,5 @@
; RUN: llc < %s
+; RUN: llc -global-isel < %s
declare i32 @llvm.expect.with.probability(i32, i32, double)
|
@@ -1,4 +1,5 @@ | |||
; RUN: llc < %s | |||
; RUN: llc -global-isel < %s | |||
|
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.
The existing test is woefully inadequate. Should fix this in a pre-commit. This needs to have checks, and should not be a "Generic" test. Those cannot exist
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 generic changes like this, is it sufficient to test against one backend or does each one need its own coverage?
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 have moved testing for GISel to the AArch64 IRTranslator no-op intrinsics suite, where similar tests lie, and removed the update to the generic one. I'll update the SelectionDAG tests to be specific and remove the generic one altogether separately.
Handle @llvm.expect.with.probability in GlobalISel in the same way @llvm.expect is handled, passing the value through as-is. This can be encountered if the intrinsic is used without optimizations, which would otherwise transform it out.
Fixes #115411 for GlobalISel