This is an archive of the discontinued LLVM Phabricator instance.

Extend FindAllMemoryUses for target intrinsics
AcceptedPublic

Authored by npjdesres on Jul 14 2017, 12:01 PM.

Details

Reviewers
reames
Summary

In order to promote instruction selection of complicated addressing
modes, CodeGenPrepaer::optimizeCallInst() determines whether an address
computation from an earlier basic-block should be sunk to its use. It
natively comprehends InlineAsm uses and it calls the target hook
TLI.getAddrModeArguments() in order to comprehend target-specific memory
intrinsics. Next, it checks optimizeMemoryInsts() to decide whether
sinking the address expression would be profitable.

Althought, optimizeMemoryInsts comprehends uses by InlineAsm, it does
*not* completely support target-specific memory intrinsics.

Specifically, optimizeMemoryInsts() calls isProfitableToFoldIntoAddressingMode(),
which calls FindAllMemoryUses(). FindAllMemoryUses does not query
the same target hook; thus it reports failure (return true)
for any call instruction which is not an InlineAsm.

This patch extends FindAllMemoryUses so that it will additionally check
whether the CallInst is recognized by the target hook.

Diff Detail

Event Timeline

npjdesres created this revision.Jul 14 2017, 12:01 PM
reames accepted this revision.Sep 29 2017, 9:09 AM

LGTM

This revision is now accepted and ready to land.Sep 29 2017, 9:09 AM

Thanks for the review. I do not have commit access. Could you please commit this? Thanks