summaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/Generic
diff options
context:
space:
mode:
authorantangelo <contact@antangelo.com>2024-11-26 20:22:25 -0500
committerGitHub <noreply@github.com>2024-11-26 20:22:25 -0500
commitdd4844722d98a97edd180e20abd4e65e1e2dd9d7 (patch)
tree40322ce4c49184e4cf109164e5160746c2fd71ee /llvm/test/CodeGen/Generic
parentea58410d0fd75c9dc6d395bba15e939ed7c35cb1 (diff)
[SelectionDAG] Add generic implementation for @llvm.expect.with.probability when optimizations are disabled (#117459)
Handle \@llvm.expect.with.probability in SelectionDAGBuilder, FastISel, and IntrinsicLowering in the same way \@llvm.expect is handled, where the value is passed through as-is. This can be reached if the intrinsic is used without optimizations, where it would otherwise be properly transformed out. Fixes #115411 for SelectionDAG. A similar patch is likely needed for GlobalISel.
Diffstat (limited to 'llvm/test/CodeGen/Generic')
-rw-r--r--llvm/test/CodeGen/Generic/builtin-expect-with-probability.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Generic/builtin-expect-with-probability.ll b/llvm/test/CodeGen/Generic/builtin-expect-with-probability.ll
new file mode 100644
index 000000000000..aef134b636d5
--- /dev/null
+++ b/llvm/test/CodeGen/Generic/builtin-expect-with-probability.ll
@@ -0,0 +1,8 @@
+; RUN: llc < %s
+
+declare i32 @llvm.expect.with.probability(i32, i32, double)
+
+define i32 @test1(i32 %val) nounwind {
+ %expected = call i32 @llvm.expect.with.probability(i32 %val, i32 1, double 0.5)
+ ret i32 %expected
+}