[PATCH] D114795: [PR52475] Ensure a correct chain in copies to/from hidden sret parameter

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 30 06:12:19 PST 2021


frasercrmck created this revision.
frasercrmck added reviewers: craig.topper, RKSimon, spatel.
Herald added subscribers: luke957, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, javed.absar, hiraditya, jgravelle-google, sbc100, dschuff.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay, aheejin.
Herald added a project: LLVM.

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://bugs.llvm.org/show_bug.cgi?id=52475


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114795

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114795.390679.patch
Type: text/x-patch
Size: 61277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211130/b593f168/attachment.bin>


More information about the llvm-commits mailing list