Issue 161636
Summary [InstCombine] Pointer equality propagated without regard to provenance
Labels miscompilation, llvm:instcombine, generated by fuzzer
Assignees dtcxzyw
Reporter dtcxzyw
    It is a variant of https://github.com/llvm/llvm-project/issues/115574.
Reproducer: https://alive2.llvm.org/ce/z/FLg923
```
define ptr @src1(ptr %p, ptr %q) {
#0:
  %cmp = icmp eq ptr %p, %q
  %#1 = freeze i1 %cmp
  %select = select i1 %#1, ptr %p, ptr %q
  ret ptr %select
}
=>
define ptr @src1(ptr %p, ptr %q) {
#0:
  %q.fr = freeze ptr %q
  ret ptr %q.fr
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
ptr %p = pointer(non-local, block_id=1, offset=0) / Address=#x1
ptr %q = pointer(non-local, block_id=0, offset=1) / Address=#x1

Source:
i1 %cmp = #x1 (1)
i1 %#1 = #x1 (1)
ptr %select = pointer(non-local, block_id=1, offset=0) / Address=#x1

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: #x0
Block 1 >	size: 13	align: 1	alloc type: 0	alive: true	address: #x1
Block 2 >	size: 0	align: 1	alloc type: 0	alive: true	address: #xf

Target:
ptr %q.fr = pointer(non-local, block_id=0, offset=1) / Address=#x1

TARGET MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >	size: 0	align: 1	alloc type: 0	alive: false	address: #x0
Block 1 >	size: 13	align: 1	alloc type: 0	alive: true	address: #x1
Block 2 >	size: 0	align: 1	alloc type: 0	alive: true	address: #xf
Source value: pointer(non-local, block_id=1, offset=0) / Address=#x1
Target value: pointer(non-local, block_id=0, offset=1) / Address=#x1
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to