[AMDGPU] SIFoldOperands: clean up tryConstantFoldOp
authorJay Foad <jay.foad@amd.com>
Wed, 7 Apr 2021 12:49:07 +0000 (13:49 +0100)
committerJay Foad <jay.foad@amd.com>
Thu, 6 May 2021 08:55:22 +0000 (09:55 +0100)
commit7c706af03b8634f1f2a64599037580e5f4785082
tree551c00f1ff1ab52ed812631fc172e7b6ce266361
parent65cd0d6be47730cefdd5be26c12f02ec59b4d08e
[AMDGPU] SIFoldOperands: clean up tryConstantFoldOp

First clean up the strange API of tryConstantFoldOp where it took an
immediate operand value, but no indication of which operand it was the
value for.

Second clean up the loop that calls tryConstantFoldOp so that it does
not have to restart from the beginning every time it folds an
instruction.

This is NFCI but there are some minor changes caused by the order in
which things are folded.

Differential Revision: https://reviews.llvm.org/D100031
llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
llvm/test/CodeGen/AMDGPU/GlobalISel/fshr.ll