[llvm] 5dbeed2 - ValueTracking: ldexp never introduces poison
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 16:55:03 PDT 2023
Author: Matt Arsenault
Date: 2023-08-11T19:54:57-04:00
New Revision: 5dbeed2e5b5f4d5f7662481d30a0ededba36dcdf
URL: https://github.com/llvm/llvm-project/commit/5dbeed2e5b5f4d5f7662481d30a0ededba36dcdf
DIFF: https://github.com/llvm/llvm-project/commit/5dbeed2e5b5f4d5f7662481d30a0ededba36dcdf.diff
LOG: ValueTracking: ldexp never introduces poison
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstCombine/freeze-fp-ops.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index aa1514129f5d3c..d8f710e26d435a 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -6581,6 +6581,7 @@ static bool canCreateUndefOrPoison(const Operator *Op, bool PoisonOnly,
case Intrinsic::minimum:
case Intrinsic::maximum:
case Intrinsic::is_fpclass:
+ case Intrinsic::ldexp:
return false;
case Intrinsic::lround:
case Intrinsic::llround:
diff --git a/llvm/test/Transforms/InstCombine/freeze-fp-ops.ll b/llvm/test/Transforms/InstCombine/freeze-fp-ops.ll
index 3a45530fbc99ed..504ad171cef140 100644
--- a/llvm/test/Transforms/InstCombine/freeze-fp-ops.ll
+++ b/llvm/test/Transforms/InstCombine/freeze-fp-ops.ll
@@ -517,6 +517,17 @@ define float @freeze_fptrunc_round(double %arg0) {
ret float %freeze
}
+define float @freeze_ldexp(float %arg0, i32 noundef %arg1) {
+; CHECK-LABEL: @freeze_ldexp(
+; CHECK-NEXT: [[ARG0_FR:%.*]] = freeze float [[ARG0:%.*]]
+; CHECK-NEXT: [[OP:%.*]] = call float @llvm.ldexp.f32.i32(float [[ARG0_FR]], i32 [[ARG1:%.*]])
+; CHECK-NEXT: ret float [[OP]]
+;
+ %op = call float @llvm.ldexp.f32.i32(float %arg0, i32 %arg1)
+ %freeze = freeze float %op
+ ret float %freeze
+}
+
declare float @llvm.fma.f32(float, float, float)
declare float @llvm.fmuladd.f32(float, float, float)
declare float @llvm.sqrt.f32(float)
@@ -550,3 +561,4 @@ declare float @llvm.minimum.f32(float, float)
declare float @llvm.maximum.f32(float, float)
declare i1 @llvm.is.fpclass.f32(float, i32 immarg)
declare float @llvm.fptrunc.round.f32.f64(double, metadata)
+declare float @llvm.ldexp.f32.i32(float, i32)
More information about the llvm-commits
mailing list