[all-commits] [llvm/llvm-project] 539908: [SelectionDAG] Look through FREEZE in getCopyToReg...

Henry Jiang via All-commits all-commits at lists.llvm.org
Mon May 4 11:16:23 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5399086ac049459901c9b527b535cd78e15fc4c9
      https://github.com/llvm/llvm-project/commit/5399086ac049459901c9b527b535cd78e15fc4c9
  Author: Henry Jiang <henry_jiang2 at apple.com>
  Date:   2026-05-04 (Mon, 04 May 2026)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    A llvm/test/CodeGen/AArch64/freeze-load-zext-copytoreg.ll
    A llvm/test/CodeGen/PowerPC/freeze-load-zext-copytoreg.ll
    A llvm/test/CodeGen/RISCV/freeze-load-zext-copytoreg.ll

  Log Message:
  -----------
  [SelectionDAG] Look through FREEZE in getCopyToRegs when checking isZExtFree (#195285)

When a narrow load i8 or i16 is frozen and its value crosses a basic
block, `getCopyToRegs` emits `any_extend` instead of `zero_extend`
because `isZExtFree` can't see through the `ISD::FREEZE` node.

Example: https://godbolt.org/z/MYvjq8vPM contains an redundant `and w11,
w11, 0xff`
```
        ldrb    w11, [x10], #1
        cmp     w11, #32
        b.lo    .LBB0_1
        and     w11, w11, #0xff
```

Fix this by passing the incoming node to the freeze to `isZExtFree`
instead.



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