[llvm] [DAGCombiner] Freeze maybe poison operands when folding select to logic (PR #84924)
Björn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 19 14:57:16 PDT 2024
================
@@ -229,10 +229,41 @@ define i32 @combine_pmaddubsw_constant_sat() {
; Constant folding PMADDWD was causing an infinite loop in the PCMPGT commuting between 2 constant values.
define i1 @pmaddwd_pcmpgt_infinite_loop() {
-; CHECK-LABEL: pmaddwd_pcmpgt_infinite_loop:
-; CHECK: # %bb.0:
-; CHECK-NEXT: movb $1, %al
-; CHECK-NEXT: retq
+; SSE-LABEL: pmaddwd_pcmpgt_infinite_loop:
----------------
bjope wrote:
Looks like we get:
```
t3: v8i16 = BUILD_VECTOR Constant:i16<-32768>, Constant:i16<-32768>, Constant:i16<-32768>, Constant:i16<-32768>, Constant:i16<-32768>, Constant:i16<-32768>, Constant:i16<-32768>, Constant:i16<-32768>
t4: v4i32 = llvm.x86.sse2.pmadd.wd TargetConstant:i64<13393>, t3, t3
t62: v4i32 = freeze t4
```
X86 can perhaps model that intrinsic as not creating poison. But a more general solution could be to let SelectionDAG::computeKnownBits look through FREEZE (and then I guess the same should be done for SelectionDAG::ComputeNumSignBits as well).
https://github.com/llvm/llvm-project/pull/84924
More information about the llvm-commits
mailing list