[llvm] [LV] Don't vectorize if trip count expansion may introduce UB. (PR #92177)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 10:53:20 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); });
----------------
efriedma-quic wrote:

> Updated the PR to also check if the divisor is guaranteed to be non-zero. 

Can we not use isSafeToExpand() for some reason?

https://github.com/llvm/llvm-project/pull/92177


More information about the llvm-commits mailing list