Issue 174045
Summary [InstSimplify] Folds vector pointer `select (icmp eq <N x ptr>)` to operand and loses provenance
Labels new issue
Assignees
Reporter cardigan1008
    Instsimplify can fold:

```llvm
%cmp = icmp eq <2 x ptr> %a, %b
%sel = select <2 x i1> %cmp, <2 x ptr> %a, %b
```

to `ret <2 x ptr> %b`, which is not always valid for pointers. Even if `%a[0]` and `%b[0]` have the same address , they might have different provenance, so selecting `%a[0]` is not equivalent to returning `%b[0]`.

Alive2 proof: https://alive2.llvm.org/ce/z/JxDjAx

Exposed from https://github.com/llvm/llvm-project/commit/1af627b592dd15bbe58136f902ced46251fc344d, cc @dtcxzyw 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to