[PATCH] D28637: [PPC] Inline expansion of memcmp
    Zaara Syeda via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Jan 12 19:57:47 PST 2017
    
    
  
syzaara created this revision.
syzaara added reviewers: kbarton, nemanjai, lei, sfertile, jtony.
syzaara added a subscriber: llvm-commits.
Currently on PowerPC, llvm does not expand calls to memcmp as it does for memcpy, memmove. When memcmp size and alignment info of the two sources being compared is known at compile time, we can do an inline expansion rather than calling the library routine. To start, only the expansion for multiples of 8 bytes is added. This expansion loads 8 bytes from the two sources to compare, xors to see if there was a difference, and then does an early exit if a difference was found. Otherwise, continues to the next 8 bytes.
The expansion is implemented at the IR level in CodeGenPrepare.cpp where other intrinsic calls are also expanded in bool CodeGenPrepare::optimizeCallInst(CallInst *CI, bool& ModifiedDT). It is only enabled by default for PowerPC, and other targets may enable it by returning true for expandMemCmp()
https://reviews.llvm.org/D28637
Files:
  include/llvm/Analysis/TargetTransformInfo.h
  include/llvm/Analysis/TargetTransformInfoImpl.h
  include/llvm/Target/TargetLowering.h
  lib/Analysis/TargetTransformInfo.cpp
  lib/CodeGen/CodeGenPrepare.cpp
  lib/CodeGen/TargetLoweringBase.cpp
  lib/Target/PowerPC/PPCISelLowering.cpp
  lib/Target/PowerPC/PPCTargetTransformInfo.cpp
  lib/Target/PowerPC/PPCTargetTransformInfo.h
  test/CodeGen/PowerPC/memcmp.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28637.84217.patch
Type: text/x-patch
Size: 14617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170113/68f0ca2a/attachment.bin>
    
    
More information about the llvm-commits
mailing list