[llvm] [InstSimplify] Fold `and A, (zext (icmp eq A, 0))` into 0 (PR #66676)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 18 12:10:12 PDT 2023
https://github.com/nikic requested changes to this pull request.
The general pattern here would be `zext(c) & a`, which is `c ? (a & 1) : 0`.
For the special case of `c := a == C`, if C is even then this reduces to `0`, if C is odd it reduces to `zext(c)`.
Possibly we shouldn't special case the `a == C` case though and just generally canonicalize to the select form, on which all possible folds can then be performed?
In any case, this needs to at least handle arbitrary constants.
https://github.com/llvm/llvm-project/pull/66676
More information about the llvm-commits
mailing list