[AMDGPU] Fix issues for backend divergence tracking
authorDavid Stuttard <david.stuttard@amd.com>
Wed, 18 Apr 2018 13:53:31 +0000 (13:53 +0000)
committerDavid Stuttard <david.stuttard@amd.com>
Wed, 18 Apr 2018 13:53:31 +0000 (13:53 +0000)
commit31f482c26bc4452f4c41d90c73bb709d00cd0264
tree81058cd9990276169061879fe7f0312cd8fe7d0d
parent3c19051bf0c6e650acce03abb2eeb5feee3ce986
[AMDGPU] Fix issues for backend divergence tracking

Summary:
A change to use divergence analysis in the AMDGPU backend was getting formal
arguments incorrect (not tagged as divergent) unless they were VGPR0, VGPR1 or
VGPR2

For graphics shaders it is possible to have more than these passed in as VGPR

Modified the checking code to check for any VGPR registers passed in as formal
arguments.

Also, some intrinsics that are sources of divergence may have been lowered
during instruction selection and are missed on subsequent calls to
isSDNodeSourceOfDivergence - added the relevant AMDGPUISD checks as well.

Finally, the FunctionLoweringInfo tracks virtual registers that are live across
basic block boundaries. This is used to check for divergence of CopyFromRegister
registers using the DivergenceAnalysis analysis. For multiple blocks the lazily
evaluated inverted map VirtReg2Value was not cleared when the ValueMap map was.

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tpr, t-tye, llvm-commits

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

Change-Id: I112f3bd6dfe0f62e63ce9b43b893982778e4bee3
llvm-svn: 330257
llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/test/CodeGen/AMDGPU/diverge-extra-formal-args.ll [new file with mode: 0644]
llvm/test/CodeGen/AMDGPU/diverge-interp-mov-lower.ll [new file with mode: 0644]