Issue |
155439
|
Summary |
[DAG] SelectionDAG::canCreateUndefOrPoison - when can we bypass poison generating flags?
|
Labels |
llvm:SelectionDAG
|
Assignees |
|
Reporter |
RKSimon
|
Currently if a node has any poison generating flags canCreateUndefOrPoison always returns true:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L5638-L5642
However, if we can easily prove the flag, e.g. nuw - when are we allowed to use valuetracking to perform a better analysis of the node?
e.g.
```ll
define i8 @src(i4 %a0, i4 %a1) {
%x0 = zext i4 %a0 to i8
%x1 = zext i4 %a1 to i8
%add = add nuw i8 %x0, %x1 ; zext proves nuw so should be safe to push freeze through to operands?
%res = freeze i8 %add
ret i8 %res
}
define i8 @tgt(i4 %a0, i4 %a1) {
%f0 = freeze i4 %a0
%f1 = freeze i4 %a1
%x0 = zext i4 %f0 to i8
%x1 = zext i4 %f1 to i8
%add = add nuw i8 %x0, %x1
ret i8 %add
}
Transformation seems to be correct!
```
CC @nikic @dtcxzyw @nunoplopes
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs