[PATCH] D39231: [SCEV][NFC] Assert that we do not expand something unsafe
Sanjoy Das via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 09:44:43 PDT 2017
sanjoy requested changes to this revision.
sanjoy added inline comments.
This revision now requires changes to proceed.
================
Comment at: lib/Analysis/ScalarEvolutionExpander.cpp:1749
+ assert(isSafeToExpand(S, SE) && "Attempt to expand something unsafe!");
SCEVInsertPointGuard Guard(Builder, this);
----------------
I think this is overtly conservative. Expanding something unsafe is a problem only if "unsafety" (in practice, today this is just division by zero) was not present in the IR before. For instance if we have `%v = udiv i32 %x, %y` in the IR then it is perfectly fine to `getSCEV` on `%v` and then re-expand it before or after `%v` since if `%y` was `0` then the program is undefined.
https://reviews.llvm.org/D39231
More information about the llvm-commits
mailing list