[PATCH] D148986: [InstSimplify] with logical ops: (X | Y) ? 0 : X --> 0
Zhu Siyuan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 22 03:38:18 PDT 2023
floatshadow added a comment.
In D148986#4289600 <https://reviews.llvm.org/D148986#4289600>, @nikic wrote:
> 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.
My concern mentioned in this issue is the case the condition of ternary operator contains multiple ORs/ANDs. There seems a need to do a recursive check (?)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148986/new/
https://reviews.llvm.org/D148986
More information about the llvm-commits
mailing list