[llvm] [LV] Rewrite UDiv A, B -> UDiv A, UMax(B, 1) in trip counts if needed. (PR #92177)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 15:02:31 PDT 2024


================
@@ -665,6 +665,12 @@ Value *SCEVExpander::visitUDivExpr(const SCEVUDivExpr *S) {
   }
 
   Value *RHS = expand(S->getRHS());
+  if (SafeUDivMode && !SE.isKnownNonZero(S->getRHS())) {
----------------
nikic wrote:

The logic here doesn't look quite right wrt the poison handling. This code does nothing if isKnownNonZero (but maybe poison). We should at least leave a TODO here.

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


More information about the llvm-commits mailing list