[llvm] [LV] Don't vectorize if trip count expansion may introduce UB. (PR #92177)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 26 07:40:02 PDT 2024
================
@@ -161,6 +161,11 @@ SCEVExpander::findInsertPointAfter(Instruction *I,
return IP;
}
+bool SCEVExpander::expansionMayIntroduceUB(const SCEV *Expr) {
+ return SCEVExprContains(Expr,
+ [](const SCEV *Op) { return isa<SCEVUDivExpr>(Op); });
----------------
fhahn wrote:
Sorry for just coming back to this now!
> In the given example, c has to be zero, I think? If c isn't zero, and b is zero, we divide by zero even before any optimizations run.
Ah yes, updated to rewrite the expression, thanks!
> Can we not use isSafeToExpand() for some reason?
Updated as well in the latest version, thanks!
https://github.com/llvm/llvm-project/pull/92177
More information about the llvm-commits
mailing list