[llvm] [ValueTracking] Mark frexp, ALM propagates poison (PR #205139)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 09:49:10 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Ramkumar Ramachandra (artagnon)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/205139.diff


3 Files Affected:

- (modified) llvm/lib/Analysis/ConstantFolding.cpp (-3) 
- (modified) llvm/lib/Analysis/ValueTracking.cpp (+2) 
- (modified) llvm/test/Transforms/InstSimplify/ConstProp/active-lane-mask.ll (+1-3) 


``````````diff
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index c7210b2e0c2d1..3f663bc61243d 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -4569,9 +4569,6 @@ static Constant *ConstantFoldScalableVectorCall(
 
 static std::pair<Constant *, Constant *>
 ConstantFoldScalarFrexpCall(Constant *Op, Type *IntTy) {
-  if (isa<PoisonValue>(Op))
-    return {Op, PoisonValue::get(IntTy)};
-
   auto *ConstFP = dyn_cast<ConstantFP>(Op);
   if (!ConstFP)
     return {};
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 9334551005224..6e4b1a977e214 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -8188,6 +8188,8 @@ bool llvm::intrinsicPropagatesPoison(Intrinsic::ID IID) {
   case Intrinsic::llrint:
   case Intrinsic::fshl:
   case Intrinsic::fshr:
+  case Intrinsic::frexp:
+  case Intrinsic::get_active_lane_mask:
     return true;
   default:
     return false;
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/active-lane-mask.ll b/llvm/test/Transforms/InstSimplify/ConstProp/active-lane-mask.ll
index e9d9ac040ea1d..e272b3f0682ef 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/active-lane-mask.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/active-lane-mask.ll
@@ -297,9 +297,7 @@ entry:
 define <4 x float> @poisonc(<4 x float> %a, i32 %n) {
 ; CHECK-LABEL: @poisonc(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[VAR27:%.*]] = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i32(i32 poison, i32 1024)
-; CHECK-NEXT:    [[VAR33:%.*]] = select <4 x i1> [[VAR27]], <4 x float> [[A:%.*]], <4 x float> zeroinitializer
-; CHECK-NEXT:    ret <4 x float> [[VAR33]]
+; CHECK-NEXT:    ret <4 x float> poison
 ;
 entry:
   %new0 = shl i1 0, 1

``````````

</details>


https://github.com/llvm/llvm-project/pull/205139


More information about the llvm-commits mailing list