[llvm] [DAG] Add computeKnownBits(FREEZE(X)) handling (PR #214095)

Kevin Le via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 20:57:59 PDT 2026


================
@@ -3388,6 +3388,12 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
 
   unsigned Opcode = Op.getOpcode();
   switch (Opcode) {
+  case ISD::FREEZE: {
+    if (isGuaranteedNotToBeUndefOrPoison(Op.getOperand(0), DemandedElts,
----------------
kneevin wrote:

I mirrored the condition from `ComputeNumSignBits` FREEZE handling in #161507. From my understanding, not-poison is definitely required because known-bits skip poison elements in BUILD_VECTOR. I'm less sure whether not-undef can be safely dropped to match the IR side. 

I'm happy to try only poison-only in a follow-up if preferred!

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


More information about the llvm-commits mailing list