[AMDGPU] SDWA operands should not intersect with potential MIs
authorSam Kolton <Sam.Kolton@amd.com>
Thu, 18 May 2017 12:12:03 +0000 (12:12 +0000)
committerSam Kolton <Sam.Kolton@amd.com>
Thu, 18 May 2017 12:12:03 +0000 (12:12 +0000)
commitebfdaf7394da63cc14ad6f13ef981bdaf4459db6
treeba158b35ec7dbc1e2691c0b359e51b120a09f180
parentd19632fa162dedcd676abb9a13aa5552d9f8c5e8
[AMDGPU] SDWA operands should not intersect with potential MIs

Summary:
There should be no intesection between SDWA operands and potential MIs. E.g.:
```
v_and_b32 v0, 0xff, v1 -> src:v1 sel:BYTE_0
v_and_b32 v2, 0xff, v0 -> src:v0 sel:BYTE_0
v_add_u32 v3, v4, v2
```
In that example it is possible that we would fold 2nd instruction into 3rd (v_add_u32_sdwa) and then try to fold 1st instruction into 2nd (that was already destroyed). So if SDWAOperand is also a potential MI then do not apply it.

Reviewers: vpykhtin, arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

llvm-svn: 303347
llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
llvm/test/CodeGen/AMDGPU/sdwa-peephole.ll