[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 15:27:58 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:
Btw, it is a bit weird that SelectionDAG::computeKnownBits is handling AssertZext as if the upper bits are known to be zero. At least as long as we say that AssertZext may result in a poison value that is violating the asserted condition.
But if we consider these three examples, then I think computeKnownBits on %3 should give the same result, right?
```
%1 = AssertZext i32 %0, i1
%2 = lshr i32 %1, 1
%3 = freeze i32 %2
```
```
%1 = AssertZext i32 %0, i1
%2 = freeze i32 %1
%3 = lshr i32 %2, 1
```
```
%1 = AssertZext i32 %0, i1
%3 = lshr i32 %1, 1
```
https://github.com/llvm/llvm-project/pull/84924
More information about the llvm-commits
mailing list