[all-commits] [llvm/llvm-project] 0f6f15: [SCEVExpander] Don't expand a UDiv with a possibly...

lijinpei-amd via All-commits all-commits at lists.llvm.org
Tue Jun 9 03:08:02 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f6f15a59f3f774a7f055f9754fe97c088390c4e
      https://github.com/llvm/llvm-project/commit/0f6f15a59f3f774a7f055f9754fe97c088390c4e
  Author: lijinpei-amd <jinpli at amd.com>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    M llvm/include/llvm/Analysis/ScalarEvolution.h
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
    A llvm/test/Transforms/IndVarSimplify/exit-value-safe-udiv.ll

  Log Message:
  -----------
  [SCEVExpander] Don't expand a UDiv with a possibly-poison divisor (#202378)

SCEVExpander::isSafeToExpand only check divisor isKnownNonZero, which
ignore the possibility of poison. For the following divisor:
```
%ct = call i32 @llvm.cttz.i32(i32 %x, i1 true)
%divisor = add i32 %ct, 1
...
%rem = urem i32 1, %divisor
```
The urem may be hoisted unsafely.

Fix by also check divisor isGuaranteedNotToBePoison.

Fixes https://github.com/llvm/llvm-project/issues/202028



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list