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.