[PATCH] D88806: [SCEV] Model inttoptr and ptrtoint casts not as unknown, but as zext/trunc/self of unknown

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 4 14:18:23 PDT 2020


lebedev.ri created this revision.
lebedev.ri added reviewers: mkazantsev, reames, efriedma, fhahn, nikic, nlopes.
lebedev.ri added a project: LLVM.
Herald added subscribers: javed.absar, hiraditya, nemanjai, qcolombet.
lebedev.ri requested review of this revision.

While we indeed can't treat them as no-ops, i think we can/should do better than just modelling them as `unknown`.

See D88788 <https://reviews.llvm.org/D88788> & D88789 <https://reviews.llvm.org/D88789> - we could end up with obviously identical casts,
and SCEV just completely give up on them. Which means, SCEV will think
that two CSE'able values are different, which i think is obviously not great:
for example it could lead to unnessesary extra safety checks.

I think, we could instead of modelling the whole cast as unknown,
we could model it as a trunc/zext/self of an unknown value.
I think, that should still be safe?

Does this make sense?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88806

Files:
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
  llvm/test/Analysis/ScalarEvolution/add-expr-pointer-operand-sorting.ll
  llvm/test/Analysis/ScalarEvolution/no-wrap-add-exprs.ll
  llvm/test/Analysis/ScalarEvolution/scalable-vector.ll
  llvm/test/Analysis/ScalarEvolution/semi-transparent-inttoptr-ptrtoint-casts.ll
  llvm/test/CodeGen/ARM/lsr-undef-in-binop.ll
  llvm/test/CodeGen/PowerPC/sms-iterator.ll
  llvm/test/CodeGen/X86/ragreedy-hoist-spill.ll
  llvm/test/Other/constant-fold-gep.ll
  llvm/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll
  llvm/test/Transforms/LoopStrengthReduce/post-inc-icmpzero.ll
  llvm/test/Transforms/PhaseOrdering/scev-custom-dl.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88806.296077.patch
Type: text/x-patch
Size: 24220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201004/f6a23816/attachment.bin>


More information about the llvm-commits mailing list