Issue 113992
Summary Wrong substitution of a PHI node
Labels new issue
Assignees
Reporter bongjunj
    Alive2 report: https://alive2.llvm.org/ce/z/89TX9n

```llvm
----------------------------------------
define i32 @sub_const_incoming0.2(i1 %b, i32 %x, i32 %y) {
entry:
  br i1 %b, label %if, label %then

if:
  br label %then

then:
  %p0 = phi i32 [ 42, %if ], [ %x, %entry ]
  %p1 = phi i32 [ undef, %if ], [ %y, %entry ]
  %r = sub i32 %p1, %p0
  ret i32 %r
}
=>
define i32 @sub_const_incoming0.2(i1 %b, i32 %x, i32 %y) {
entry:
  br i1 %b, label %if, label %then

if:
  br label %then

then:
  %p0 = phi i32 [ 42, %if ], [ %x, %entry ]
  %r = sub i32 %y, %p0
  ret i32 %r
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
i1 %b = #x1 (1)
i32 %x = poison
i32 %y = poison

Source:
  >> Jump to %if
  >> Jump to %then
i32 %p0 = #x0000002a (42)
i32 %p1 = #x00000000 (0)	[based on undef value]
i32 %r = #xffffffd6 (4294967254, -42)

Target:
  >> Jump to %if
  >> Jump to %then
i32 %p0 = #x0000002a (42)
i32 %r = poison
Source value: #xffffffd6 (4294967254, -42)
Target value: poison

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to