[llvm-branch-commits] [CGP] Mark profiles in foldURemOfLoopIncrement (PR #238967)
Aiden Grossman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Nov 5 15:59:18 PST 2026
================
@@ -2111,6 +2111,8 @@ static bool foldURemOfLoopIncrement(Instruction *Rem, const DataLayout *DL,
Value *RemCmp = Builder.CreateICmp(ICmpInst::ICMP_EQ, RemAdd, RemAmt);
Value *RemSel =
Builder.CreateSelect(RemCmp, Constant::getNullValue(Ty), RemAdd);
+ if (auto *SI = dyn_cast<SelectInst>(RemSel))
----------------
boomanaiden154 wrote:
This isn't a null check. We're checking the loop IV is equal to some condition, and that condition might be runtime unknown. There's no way to infer what side is more likely in the general case.
SCEV might be able to help in some cases, but it's not already computed inside CGP so the compile-time cost is likely prohibitive.
https://github.com/llvm/llvm-project/pull/238967
More information about the llvm-branch-commits
mailing list