[PATCH] D149080: [AMDGPU] Fix negative offset values interpretation in getMemOperandsWithOffset for DS

Janek van Oirschot via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 10:26:47 PDT 2023


JanekvO created this revision.
Herald added subscribers: kosarev, foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl, arsenm.
Herald added a project: All.
JanekvO requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

The offset values may result in an erroneous scheduling of a load before write for a memory location if the offset values are represented as negative values in MIR, despite actually being unsigned values. This representation in MIR happens as SelectionDAG::getConstant could go through APInt to represent the encoding which assumes the MSB of the encoding as a sign-bit, regardless of whether it is supposed to be a signed value. The 8-bit negative (interpreted) value gets cast to an unsigned 32 bit value in getMemOperandsWithOffset used for comparisons in areMemAccessesTriviallyDisjoint eventually leading to an erroneous schedule in the machine scheduler.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149080

Files:
  llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
  llvm/test/CodeGen/AMDGPU/si-triv-disjoint-mem-access.ll
  llvm/test/CodeGen/AMDGPU/triv-disjoint-mem-access-neg-offset.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149080.516457.patch
Type: text/x-patch
Size: 11563 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230424/f5e6e036/attachment.bin>


More information about the llvm-commits mailing list