[ValueTracking] Improve impliesPoison to look into overflow intrinsics
authorJuneyoung Lee <aqjune@gmail.com>
Sun, 2 May 2021 03:02:02 +0000 (12:02 +0900)
committerJuneyoung Lee <aqjune@gmail.com>
Sun, 2 May 2021 03:03:55 +0000 (12:03 +0900)
commit64e768e8162a3d32049ed5c38fd533beecb0c9af
treef9d5f4bcbde0819863d861370d17ac8ddd2f6b81
parentff7f27fe67dbfb7b2c0788c0603fde2b245d1b40
[ValueTracking] Improve impliesPoison to look into overflow intrinsics

This update supports the following transformation:

```
select(extract(mul_with_overflow(a, _), _), (a == 0), false)
=>
and(extract(mul_with_overflow(a, _), _), (a == 0))
```

which is correct because if `a` was poison the select's condition was
also poison.

This update is splitted from D101423.
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstCombine/div-by-0-guard-before-smul_ov-not.ll
llvm/test/Transforms/InstCombine/div-by-0-guard-before-smul_ov.ll
llvm/test/Transforms/InstCombine/div-by-0-guard-before-umul_ov-not.ll
llvm/test/Transforms/InstCombine/div-by-0-guard-before-umul_ov.ll