[PATCH] D112389: [SCEV] Move SCEVLostPoisonFlags() check into SCEVExpander

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 10:17:50 PDT 2021


reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.

So, LGTM to the code motion, but I think this code is badly incomplete.

If I understand it correctly, the intent is to prevent SCEVExpander from reusing an IR instruction with flags stronger than those implied by the SCEV.  This is a laudable goal, but the code completely ignores folding of the binop during SCEV construction.

I see two correct approaches:

1. Default to returning true (meaning can't reuse) unless we can prove flag match.  This is somewhat the inverse of the current code.
2. drop poison generating flags from the IR instruction

We could, of course, use some combination of both.

Any chance you'd be willing to follow up here?  If not, I probably will.


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

https://reviews.llvm.org/D112389



More information about the llvm-commits mailing list