| Issue |
239444
|
| Summary |
[DAGCombine] Endless recombinging in visitUINT_TO_FP()
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
JonPsson1
|
It seems that 86d42a0 "[DAGCombiner] Narrow the integer source of uint_to_fp" is causing an infinite combining loop on SystemZ.
cat reduced.ll
```
target datalayout = "E-S64-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
target triple = "s390x-unknown-linux-gnu"
define <4 x double> @SetImageAlphaChannel(<4 x i16> %strided.vec308) {
entry:
%0 = uitofp <4 x i16> %strided.vec308 to <4 x double>
ret <4 x double> %0
}
```
`llc -mtriple=s390x-linux-gnu -mcpu=z17 -O3 reduced.ll -o out.s
`
Initial selection DAG:
```
SelectionDAG has 14 nodes:
t0: ch,glue = EntryToken
t2: v8i16,ch = CopyFromReg t0, Register:v8i16 %0
t4: v4i16 = extract_subvector t2, Constant:i32<0>
t5: v4f64 = uint_to_fp t4
t6: v2f64 = extract_subvector t5, Constant:i32<0>
t10: ch,glue = CopyToReg t0, Register:v2f64 $v24, t6
t8: v2f64 = extract_subvector t5, Constant:i32<2>
t12: ch,glue = CopyToReg t10, Register:v2f64 $v26, t8, t10:1
t13: ch = SystemZISD::RET_GLUE t12, Register:v2f64 $v24, Register:v2f64 $v26, t12:1
```
So there is the UINT_TO_FP from a v4i16 to v4f64 in the input.
SystemZTargetLowering::combineINT_TO_FP() performs a custom combine of inserting a zero_extend of the source vector. The result is:
```
t14: v4i64 = zero_extend t4
t15: v4f64 = uint_to_fp t14
```
The problematic commit then undoes this even though there is a check that tries to avoid it:
```
// Avoid undoing a target combine that widened the source operand.
if (N0.getOpcode() == ISD::ZERO_EXTEND &&
NarrowVT == N0.getOperand(0).getValueType())
continue;
```
It actually creates a ZERO_EXTEND to v4i32. So it will then alternate infinitely between zero extending to v4i32 and v4i64. On SystemZ there are vector conversion support if the source and dest operands have the same width, so the proper fix should be to not undo the SystemZ version, i.e. the extension should be to v4i64.
@harrisonGPU
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs