[llvm] [LV] Rewrite UDiv A, B -> UDiv A, UMax(B, 1) in trip counts if needed. (PR #92177)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 28 13:30:20 PDT 2024
================
@@ -665,6 +665,12 @@ Value *SCEVExpander::visitUDivExpr(const SCEVUDivExpr *S) {
}
Value *RHS = expand(S->getRHS());
+ if (SafeUDivMode && !SE.isKnownNonZero(S->getRHS())) {
----------------
fhahn wrote:
Updated to check to only consider non-zero constants safe, thanks.
Maybe worth introducing a `isKnownNonPoison()` helper?
https://github.com/llvm/llvm-project/pull/92177
More information about the llvm-commits
mailing list