[llvm] [SCEVExpander] Don't expand a UDiv with a possibly-poison divisor (PR #202378)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 01:24:19 PDT 2026


================
@@ -0,0 +1,44 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=indvars < %s | FileCheck %s
+
+; Reduced from https://github.com/llvm/llvm-project/issues/202028.
+
+target triple = "x86_64-unknown-linux-gnu"
----------------
lijinpei wrote:

`X86TTIImpl::getArithmeticInstrCost` reports 1 for udiv/urem , while `TargetTransformInfoImplBase::getArithmeticInstrCost`, reports 4. `rewriteLoopExitValues` needs the cost to be cheap to hoist it.
Now I replaced it with `-replexitval=always`.

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


More information about the llvm-commits mailing list