[PATCH] D50222: [CodeGen] [SelectionDAG] More efficient code for X % C == 0
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 20 00:18:56 PDT 2018
lebedev.ri added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:3372-3392
+ // fold (rem lhs, rhs) -> lhs when |lhs| < |rhs|
+ // FIXME: this optimization is otherwise missed if BuildREMEqFold succeeds.
+ // Ref: test1 in test/CodeGen/X86/jump_sign.ll
+ if (N1C) {
+ KnownBits LHSBits;
+ DAG.computeKnownBits(N0, LHSBits);
+ LHSBits.makeNonNegative();
----------------
lebedev.ri wrote:
> I think this is independent from the rest?
> Can you split it into a separate review?
You could put this fold into the middle-end, into instsimplify, if we don't do it already.
But since it needs `computeKnownBits()`, some measurements would be needed
(how many times does it fire on some codebase? possibly, measure compile-time impact)
Repository:
rL LLVM
https://reviews.llvm.org/D50222
More information about the llvm-commits
mailing list