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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 17:43:22 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); });
----------------
nikic wrote:

This is `SCEVExpander::isSafeToExpand()`. (I think the SafeToHoist stuff is some half-dead leftover to handle call-sites that fail to call isSafeToExpand.)

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


More information about the llvm-commits mailing list