[PATCH] D77868: [InstSimplify] fold select of bools using bitwise logic
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 10 10:50:09 PDT 2020
aqjune added a comment.
Maybe I can write a simple version of `bool isPoisonIf(Value *X, Value *PoisonAssumedVal)` into ValueTracking which returns true if `X` is poison, given that `PoisonAssumedVal` is already poison.
Then, the optimizing part can be rewritten as:
// select Cond, T, false --> Cond & T
if (match(F, m_ZeroInt()) && isPoisonIf(Cond, T))
return SimplifyAndInst(Cond, T, Q);
This will also support folding `select (icmp X, C1), (icmp X, C2), false`, because `(icmp X, C1)` is poison if `(icmp X, C2)` was poison.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77868/new/
https://reviews.llvm.org/D77868
More information about the llvm-commits
mailing list