[llvm] [InstCombine] Push freeze through non-recurrence PHIs (PR #157678)

Cullen Rhodes via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 07:05:52 PDT 2025


c-rhodes wrote:

> I found reverting the change to `pushFreezeToPreventPoisonFromPropagating` in [[InstCombine] Allow freezing multiple operands #154336](https://github.com/llvm/llvm-project/pull/154336) to emit the freezes in a more natural order fixes the hang:
> 
> 
> ```
> diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
> index 6004feb1d885..51739e818d59 100644
> --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
> +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
> @@ -5041,7 +5047,7 @@ InstCombinerImpl::pushFreezeToPreventPoisonFromPropagating(FreezeInst &OrigFI) {
>        continue;
> 
>      // reverse() to emit freezes in a more natural order.
> -    for (Use &Op : reverse(I->operands())) {
> +    for (Use &Op : I->operands()) {
>        Value *OpV = Op.get();
>        if (isa<MetadataAsValue>(OpV) || isGuaranteedNotToBeUndefOrPoison(OpV))
>          continue;
> ```

@nikic any ideas here? Not sure if this is an acceptable fix.


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


More information about the llvm-commits mailing list