[PATCH] D54515: [ARM] Replace trunc for switch as a sink

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 14 00:43:40 PST 2018


samparker created this revision.
samparker added reviewers: SjoerdMeijer, dmgreen.
Herald added subscribers: chrib, kristof.beyls, javed.absar.

Truncs are treated as sources if their produce a value of the same type as the one we currently trying to promote. Truncs used to be considered as a sink if their operand was the same value type.

      

We now allow smaller types in the search, so we should search through truncs that produce a smaller value. These truncs can then be converted to an AND mask.

      

This leaves sinks as being:

- points where the value in the register is being observed, such as an icmp, switch or store.
- points where value types have to match, such as calls and returns.
- zext are included to ease the transformation and are generally removed later on.

During this change, it also became apart from truncating for sinks was broken: if a sink used a source, its type information had already been lost by the time the truncation happens. So I've changed the method of caching the type information. Most of the changes are cosmetic because IRPromoter now holds all the sets as members, so they don't need to be passed around everywhere. Changes that affect code generation:

- isSink reports false for truncs and true for switches that have a conditon < TypeSize.
- ReplaceAllUsers has become a method of IRPromoter.
- TruncTysMap stores a vector of types, one for each operand.
- visited truncs are converted to AND masks.


https://reviews.llvm.org/D54515

Files:
  lib/Target/ARM/ARMCodeGenPrepare.cpp
  test/CodeGen/ARM/CGP/arm-cgp-calls.ll
  test/CodeGen/ARM/CGP/arm-cgp-casts.ll
  test/CodeGen/ARM/CGP/arm-cgp-phis-ret.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54515.173993.patch
Type: text/x-patch
Size: 16748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181114/5d700073/attachment.bin>


More information about the llvm-commits mailing list