[AArch64][GlobalISel] Fix one use check in getTestBitReg
authorJessica Paquette <jpaquette@apple.com>
Tue, 4 Feb 2020 23:10:53 +0000 (15:10 -0800)
committerJessica Paquette <jpaquette@apple.com>
Wed, 5 Feb 2020 17:54:52 +0000 (09:54 -0800)
commita82a28ae12ae06e6ef1b8364f465e9ea5218fe8a
tree9886c8e570de1b25522a30d59b6db97a750b59d4
parente65e6d052ed438843c1e8bc00524c766505966e3
[AArch64][GlobalISel] Fix one use check in getTestBitReg

(1) The check needs to be on the 0th operand of whatever we're folding
(2) Checks for validity should happen before we change the bit

Fixes a bug which caused MultiSource/Applications/JM/lencod to fail at -O3.

Differential Revision: https://reviews.llvm.org/D74002
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-ext-tbz-tbnz.mir
llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-shift-tbz-tbnz.mir