[all-commits] [llvm/llvm-project] b0319a: [PR52475] Ensure a correct chain in copies to/from...

Fraser Cormack via All-commits all-commits at lists.llvm.org
Mon Dec 13 02:56:12 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b0319ab79bf59669803cc2475fae1d12f8eeaca9
      https://github.com/llvm/llvm-project/commit/b0319ab79bf59669803cc2475fae1d12f8eeaca9
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2021-12-13 (Mon, 13 Dec 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-calling-conv-fastcc.ll
    M llvm/test/CodeGen/RISCV/rvv/fixed-vectors-calling-conv.ll
    A llvm/test/CodeGen/RISCV/rvv/pr52475.ll
    M llvm/test/CodeGen/RISCV/srem-vector-lkk.ll
    M llvm/test/CodeGen/RISCV/urem-vector-lkk.ll
    M llvm/test/CodeGen/WebAssembly/multi-return.ll
    M llvm/test/CodeGen/WebAssembly/simd-conversions.ll
    M llvm/test/CodeGen/X86/addcarry.ll
    M llvm/test/CodeGen/X86/fp128-cast.ll
    M llvm/test/CodeGen/X86/i128-add.ll
    M llvm/test/CodeGen/X86/masked_load.ll
    M llvm/test/CodeGen/X86/mul128.ll
    M llvm/test/CodeGen/X86/pmulh.ll
    M llvm/test/CodeGen/X86/scheduler-backtracking.ll
    M llvm/test/CodeGen/X86/subcarry.ll
    M llvm/test/CodeGen/X86/umul-with-overflow.ll
    M llvm/test/CodeGen/X86/umulo-128-legalisation-lowering.ll

  Log Message:
  -----------
  [PR52475] Ensure a correct chain in copies to/from hidden sret parameter

This patch fixes an issue during SelectionDAG construction. When the
target is unable to lower the function's return value, a hidden sret
parameter is created. It is initialized and copied to a stored variable
(DemoteRegister) with CopyToReg and is later fetched with
CopyFromReg. The bug is that the chains used for each copy are
inconsistent, and thus in rare cases the scheduler may issue them out of
order.

The fix is to ensure that the CopyFromReg uses the DAG root which is set
as the chain corresponding to the initial CopyToReg.

Fixes https://llvm.org/PR52475

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D114795




More information about the All-commits mailing list