[PATCH] D148986: [InstSimplify] with logical ops: (X | Y) ? 0 : X --> 0

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 22 03:25:49 PDT 2023


nikic requested changes to this revision.
nikic added a comment.
This revision now requires changes to proceed.

As this is the second special case for this pattern, we should generalize it.

1. Extract https://github.com/llvm/llvm-project/blob/9ea3fcfa380c6097fddd0d9a9b2c13f0f20bc41a/llvm/lib/Analysis/InstructionSimplify.cpp#L4569-L4582 in one direction into a helper, and call it in both directions there.
2. Add a special case for or equals zero and and equals minus one where we try the replacement with the operands of the or/and.
3. Remove https://github.com/llvm/llvm-project/blob/9ea3fcfa380c6097fddd0d9a9b2c13f0f20bc41a/llvm/lib/Analysis/InstructionSimplify.cpp#L4585-L4598, which is subsumed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148986/new/

https://reviews.llvm.org/D148986



More information about the llvm-commits mailing list