[PATCH] D82721: [ScalarEvolution] createSCEV(): MatchBinaryOp(): recognize `urem` disguised as an `srem`
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 28 10:47:56 PDT 2020
lebedev.ri created this revision.
lebedev.ri added reviewers: mkazantsev, efriedma, nikic, reames.
Herald added subscribers: llvm-commits, javed.absar, hiraditya.
Herald added a project: LLVM.
lebedev.ri edited the summary of this revision.
lebedev.ri marked an inline comment as done.
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:4345
+ case Instruction::SRem: {
+ // If the sign bits of both operands are zero (i.e. we can prove they are
----------------
This is a pretty verbatim copypasta from `InstCombiner::visitSRem()`
While InstCombine trivially converts that `srem` into a `urem`,
it might happen later than wanted, in particular i'd like
for that to happen on https://godbolt.org/z/bwuEmJ test case
early in pipeline, before first instcombine run, just before `-mem2reg`.
SCEV should recognize this case natively.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D82721
Files:
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/srem.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82721.273955.patch
Type: text/x-patch
Size: 5639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200628/61957d87/attachment-0001.bin>
More information about the llvm-commits
mailing list