[llvm] [InstCombine] Support well-defined recurrences in isGuaranteedNotToBeUndefOrPoison (PR #150420)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 24 06:55:09 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Cullen Rhodes (c-rhodes)
<details>
<summary>Changes</summary>
This function currently doesn't detect well-defined recurrences that can't produce undef or poison. This prevents instcombine from pushing freezes through GEPs to the ptr which may be undef or poison, when the offset is a well-defined recurrence, as the tests added in #<!-- -->145541 demonstrate.
This patch fixes this by pulling existing code from foldFreezeIntoRecurrence in instcombine, which can detect whether a PHI produces undef/poison, so it can be reused by
isGuaranteedNotToBeUndefOrPoison in ValueTracking.
---
Full diff: https://github.com/llvm/llvm-project/pull/150420.diff
9 Files Affected:
- (modified) llvm/include/llvm/Analysis/ValueTracking.h (+8)
- (modified) llvm/lib/Analysis/ValueTracking.cpp (+67)
- (modified) llvm/lib/Transforms/InstCombine/InstructionCombining.cpp (+9-53)
- (modified) llvm/test/Transforms/Attributor/dereferenceable-1.ll (+2-2)
- (modified) llvm/test/Transforms/Attributor/value-simplify.ll (+6-2)
- (modified) llvm/test/Transforms/InstCombine/freeze-landingpad.ll (+4-5)
- (modified) llvm/test/Transforms/InstCombine/freeze.ll (+11-11)
- (modified) llvm/test/Transforms/LoopUnroll/runtime-exit-phi-scev-invalidation.ll (+3-5)
- (modified) llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-select.ll (+1-2)
``````````diff
``````````
</details>
https://github.com/llvm/llvm-project/pull/150420
More information about the llvm-commits
mailing list