AMDGPU: Replace shrunk instruction with dummy implicit_def
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 3 May 2019 14:40:10 +0000 (14:40 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 3 May 2019 14:40:10 +0000 (14:40 +0000)
commit0446fbe45ecf417cc05cddc198a3503ea8d2bc81
tree67d58564e3c6f02039d30c6fe82a776d90ffb0a3
parentbc876df3a5f0f25b7c43a90e4c35f553ca5362df
AMDGPU: Replace shrunk instruction with dummy implicit_def

This was broken if the original operand was killed. The kill flag
would appear on both instructions, and fail the verifier. Keep the
kill flag, but remove the operands from the old instruction. This has
an added benefit of really reducing the use count for future folds.

Ideally the pass would be structured more like what PeepholeOptimizer
does to avoid this hack to avoid breaking instruction iterators.

llvm-svn: 359891
llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
llvm/test/CodeGen/AMDGPU/fold-immediate-operand-shrink.mir