[llvm] [InstCombine] Fold trunc nuw i1 to false when dominated by icmp. (PR #151961)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 17 12:01:15 PDT 2025


andjo403 wrote:

this PR still gives changes in the llvm-opt-benchmark when I run it locally after the SCCP PR was merged.
eg bench/zed-rs/optimized/f2m41hcwghjno5p8tkrposn1f.ll and bench/ruff-rs/optimized/8dg5gv1ul0w7vccunqd3ii3jp.ll from the first run https://github.com/dtcxzyw/llvm-opt-benchmark/pull/2643/files.
but it is only 15 files now from 71 before and some of the files changed was not part of the first run.

I can try to look at why SCCP is not enough.

background for why I added this here was that I fund this fold for icmp and was thinking of adding trunc nuw support there and was not able to find something similar for trunc. https://github.com/llvm/llvm-project/blob/0561ff6a12e1219af0ea6146c62233b18b82475b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp#L1407-L1480

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


More information about the llvm-commits mailing list