[PATCH] D54192: [ARM] Fix CPSR liveness in tMOVCCr_pseudo lowering.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 6 17:48:10 PST 2018


efriedma created this revision.
efriedma added reviewers: dmgreen, SjoerdMeijer, olista01, t.p.northover.
Herald added subscribers: chrib, kristof.beyls, javed.absar.

The lowering was missing live-ins in certain cases, like a sequence of multiple tMOVCCr_pseudo instructions.  This would lead to a verifier failure, and on pre-v6 Thumb CPSR would be incorrectly clobbered.

For reasons I don't completely understand, it's hard to get a sequence of multiple tMOVCCr_pseudo instructions; the issue only seems to show up with 64-bit comparisons where the result is zero-extended.  I added some extra testcases in case that changes in the future.  Probably some optimization opportunities here if anyone is interested.  (`@test_slt_not` is the case that was getting miscompiled.)

The code to check the liveness of CPSR was stolen from X86ISelLowering.cpp; maybe it could be refactored into common helper, but I have no idea where to put it.


Repository:
  rL LLVM

https://reviews.llvm.org/D54192

Files:
  lib/Target/ARM/ARMISelLowering.cpp
  test/CodeGen/ARM/wide-compares.ll
  test/CodeGen/Thumb/select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54192.172883.patch
Type: text/x-patch
Size: 13638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181107/9f5caf45/attachment.bin>


More information about the llvm-commits mailing list