]> granicus.if.org Git - llvm/commit
[IfCvt][ARM] Optimise diamond if-conversion for code size
authorOliver Stannard <oliver.stannard@linaro.org>
Thu, 10 Oct 2019 09:58:28 +0000 (09:58 +0000)
committerOliver Stannard <oliver.stannard@linaro.org>
Thu, 10 Oct 2019 09:58:28 +0000 (09:58 +0000)
commit65b47b2f6bee07a80be3b7fbef7189d7df82e896
tree65cf652e1c521f5a9ff1ec7cb9641b78ca5182f9
parent318bd2750524a3aaff48f3d6e10391700bffa0ea
[IfCvt][ARM] Optimise diamond if-conversion for code size

Currently, the heuristics the if-conversion pass uses for diamond if-conversion
are based on execution time, with no consideration for code size. This adds a
new set of heuristics to be used when optimising for code size.

This is mostly target-independent, because the if-conversion pass can
see the code size of the instructions which it is removing. For thumb,
there are a few passes (insertion of IT instructions, selection of
narrow branches, and selection of CBZ instructions) which are run after
if conversion and affect these heuristics, so I've added target hooks to
better predict the code-size effect of a proposed if-conversion.

Differential revision: https://reviews.llvm.org/D67350

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374301 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/TargetInstrInfo.h
lib/CodeGen/IfConversion.cpp
lib/Target/ARM/ARMBaseInstrInfo.cpp
lib/Target/ARM/ARMBaseInstrInfo.h
test/CodeGen/ARM/ifcvt-size.mir [new file with mode: 0644]