[PATCH] D69044: [X86] Allow up to 4 loads per inline memcmp()

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 19 09:56:20 PDT 2019


craig.topper added a comment.

This seems to fix it. I haven't tested to see if it effects any existing tests

  diff --git a/llvm/lib/CodeGen/ExpandMemCmp.cpp b/llvm/lib/CodeGen/ExpandMemCmp.cpp
  index 9916f2de041..0539db58a61 100644
  --- a/llvm/lib/CodeGen/ExpandMemCmp.cpp
  +++ b/llvm/lib/CodeGen/ExpandMemCmp.cpp
  @@ -264,9 +264,9 @@ Value *MemCmpExpansion::getPtrToElementAtOffset(Value *Source,
                                                   uint64_t OffsetBytes) {
     if (OffsetBytes > 0) {
       auto *ByteType = Type::getInt8Ty(CI->getContext());
  -    Source = Builder.CreateGEP(
  +    Source = Builder.CreateConstGEP1_64(
           ByteType, Builder.CreateBitCast(Source, ByteType->getPointerTo()),
  -        ConstantInt::get(ByteType, OffsetBytes));
  +        OffsetBytes);
     }
     return Builder.CreateBitCast(Source, LoadSizeType->getPointerTo());
   }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69044/new/

https://reviews.llvm.org/D69044





More information about the llvm-commits mailing list