[PATCH] D63225: AMDGPU: Fold readlane from copy of SGPR or imm

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 13:15:08 PDT 2019


arsenm marked an inline comment as done.
arsenm added inline comments.


================
Comment at: lib/Target/AMDGPU/SIFoldOperands.cpp:525
+      // %vgpr = V_MOV_B32 imm
+      // %sgpr = V_READFIRSTLANE_B32 %vgpr
+      // =>
----------------
rampitec wrote:
> arsenm wrote:
> > rampitec wrote:
> > > I do not think it is correct. If first lane is off you will fold wrong value. In both cases of readfirstlane and readlane you need to check a specific lane, which I am not sure even possible.
> > readlane ignores exec. readfirstlane only reads exec to find the first lane, and still returns a result when  exec is 0. The source value is a constant, so it doesn't matter what the lane is
> Readlane ignores exec, but v_mov_b32 does not. So you may have an old value of vgpr instead of immediate.
> For readfirstlane you will get wrong value on the sgpr if exec=0 I believe.
It would matter if there was an exec def between the copy and the use, which I want to ban within a block


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63225/new/

https://reviews.llvm.org/D63225





More information about the llvm-commits mailing list