[PATCH] D80585: [AArch64][GlobalISel] Do not modify predicate when optimizing G_ICMP
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 26 13:05:54 PDT 2020
paquette created this revision.
paquette added a reviewer: aemerson.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls, rovka.
Herald added a project: LLVM.
This fixes a bug in `tryOptArithImmedIntegerCompare`.
It is unsafe to update the predicate on a MachineOperand when optimizing a G_ICMP, because it may be used in more than one place.
For example, when we are optimizing G_SELECT, we allow compares which are used in more than one G_SELECT. If we modify the G_ICMP, then we'll break one of the G_SELECTs.
Since the compare is being produced to either
1. Select a G_ICMP
2. Fold a G_ICMP into an instruction when profitable
there's no reason to actually modify it. The change is local to the specific compare.
Instead, pass a `CmpInst::Predicate` to `tryOptArithImmedIntegerCompare` which can be modified by reference.
https://reviews.llvm.org/D80585
Files:
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/select-arith-immed-compare.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80585.266307.patch
Type: text/x-patch
Size: 5825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200526/f07407b8/attachment.bin>
More information about the llvm-commits
mailing list