[AArch64][GlobalISel] Check if G_SELECT has been optimized when folding binops
authorJessica Paquette <jpaquette@apple.com>
Tue, 8 Dec 2020 21:39:28 +0000 (13:39 -0800)
committerJessica Paquette <jpaquette@apple.com>
Tue, 8 Dec 2020 21:47:08 +0000 (13:47 -0800)
commit21308c2b4c9dda8d44d2792f1359fc6b54984b87
treea5250e1b9b73d88de7936df1e999ccd9fa880023
parentb85c6e5bcd1a9de941c318f9a5dc742818752a56
[AArch64][GlobalISel] Check if G_SELECT has been optimized when folding binops

`TryFoldBinOpIntoSelect` didn't have a check for `Optimized`, meaning you could
end up folding twice. (e.g. a select with a G_ADD on the true side, and a G_SUB
on the false side)

Add in the missing `if` and a test.
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/select-select.mir