[AArch64][GlobalISel] When generating SUBS for compares, don't write to wzr/xzr.
authorAmara Emerson <aemerson@apple.com>
Fri, 22 May 2020 22:22:29 +0000 (15:22 -0700)
committerAmara Emerson <aemerson@apple.com>
Sun, 24 May 2020 05:59:49 +0000 (22:59 -0700)
commit99660217e930c131407766f68024f76acc375597
tree4d2d1568c13216fea4d2d72cb6dacf805c6ccaba
parent088fb9734843c09493d5965baed775c4ec32d5fb
[AArch64][GlobalISel] When generating SUBS for compares, don't write to wzr/xzr.

Although writing to wzr/xzr is correct since we don't care about the result
of the sub, only the flags, doing so causes tail merge blocks to fail.

Writing to an unused virtual register instead allows the optimization to fire,
improving performance significantly on 256.bzip2.

Differential Revision: https://reviews.llvm.org/D80460
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-compare.mir
llvm/test/CodeGen/AArch64/GlobalISel/select-arith-immed-compare.mir
llvm/test/CodeGen/AArch64/GlobalISel/select-cmp.mir
llvm/test/CodeGen/AArch64/GlobalISel/select.mir
llvm/test/CodeGen/AArch64/GlobalISel/tbnz-slt.mir
llvm/test/CodeGen/AArch64/GlobalISel/tbz-sgt.mir