This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Ressociate patterns with sub to use SALU
AcceptedPublic

Authored by bcl5980 on Apr 16 2023, 4:42 AM.

Diff Detail

Event Timeline

bcl5980 created this revision.Apr 16 2023, 4:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 16 2023, 4:42 AM
bcl5980 requested review of this revision.Apr 16 2023, 4:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 16 2023, 4:42 AM
bcl5980 retitled this revision from [AMDGPU] Ressociate sub + add/ sub + sub to use SALU to [AMDGPU] Ressociate patterns with sub to use SALU.Apr 16 2023, 4:43 AM
rampitec accepted this revision.Apr 17 2023, 11:08 AM

Looks reasonable.

This revision is now accepted and ready to land.Apr 17 2023, 11:08 AM
This revision was landed with ongoing or failed builds.Apr 17 2023, 3:49 PM
This revision was automatically updated to reflect the committed changes.

This change appears to be causing an infinite loop for one of our shaders.

foad added a comment.Apr 18 2023, 9:32 AM

Here's a test case for the infinite loop. Can you please fix or revert?

; RUN: llc -march=amdgcn -mcpu=gfx1030 < %s
define amdgpu_cs void @f(i32 inreg %arg, i32 %arg1) {
bb:
  %i = add i32 %arg1, %arg
  %i2 = sub i32 0, %i
  call void @llvm.amdgcn.raw.buffer.store.i32(i32 %i2, <4 x i32> zeroinitializer, i32 0, i32 0, i32 0)
  ret void
}
declare void @llvm.amdgcn.raw.buffer.store.i32(i32, <4 x i32>, i32, i32, i32 immarg)
bcl5980 updated this revision to Diff 514814.Apr 18 2023, 8:12 PM

limit the optimization to non-constant value to workaround dead loop.

I have already revert it on rG9356097206a17
Can someone help to review the new patch?

bcl5980 updated this revision to Diff 514815.Apr 18 2023, 8:18 PM

rebase the code

bcl5980 reopened this revision.Apr 19 2023, 4:41 AM
This revision is now accepted and ready to land.Apr 19 2023, 4:41 AM

Did you find what DAG transformation undoes this? It might be better to tweak that one instead.

Did you find what DAG transformation undoes this? It might be better to tweak that one instead.

Yeah, that is what I do in D148710.