[PATCH] D104403: [SCEV] Avoid pointer subtraction of non-integral pointers [WIP]

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 11:30:00 PDT 2021


efriedma added a comment.

For normal pointers, I expect that what we want for pointer subtraction (cases where the RHS is a pointer) is to just ptrtoint the operands.  It's easy to implement, and the result is intuitive.

Not sure that operation should be part of getMinusSCEV(), or if we should add a separate getPointerDiffSCEV().  Maybe worth separating if getPointerDiffSCEV() is going to be fallible (so getMinusSCEV stays infallible).

If we wanted to optimize getPointerDiffSCEV() for weird pointers, we could try to transform pointer subtraction to integral subtraction if the operands have the same pointer base.  Not sure how important this is in practice.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104403/new/

https://reviews.llvm.org/D104403



More information about the llvm-commits mailing list