[PATCH] D85092: [InstSimplify] Peephole optimization for icmp (urem X, Y), X
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 2 06:53:09 PDT 2020
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2967
+ // icmp pred (urem Y, X), Y
+ if (LBO && match(LBO, m_URem(m_Specific(RHS), m_Value()))) {
----------------
lebedev.ri wrote:
> This appears correct, but you also need to handle ` icmp pred Y, (urem Y, X)` case.
> I know that naively one would expect it to be canonicalized by complexity sorting,
> and i think said complexity sorting is a subtle evil.
I've applied some cleanup in https://github.com/llvm/llvm-project/commit/a0addbb4ec8c7bf791139699d46b08413c46eed7 to only explicitly handle the binop on the LHS and treat the other side via swapped predicate.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85092/new/
https://reviews.llvm.org/D85092
More information about the llvm-commits
mailing list