[PATCH] D28637: [PPC] Inline expansion of memcmp

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 16 10:16:03 PST 2017

efriedma added inline comments.

Comment at: lib/CodeGen/CodeGenPrepare.cpp:1992
+    LoadSrc1 = Builder.CreateLoad(Int64Ty, Source1Cast);
+    LoadSrc2 = Builder.CreateLoad(Int64Ty, Source2Cast);
+    Src1List.push_back(LoadSrc1);
nemanjai wrote:
> efriedma wrote:
> > You need to explicitly set the alignment to 1 here.
> Do we want to set it to 1 or to whatever the alignment the arguments to the CallInst had?
> But I agree we need to set it explicitly.
Well, if you can prove the pointer passed to the load has higher alignment, you can refine it... I guess you might want to do that here since instcombine won't run after CodeGenPrepare.

Comment at: lib/CodeGen/CodeGenPrepare.cpp:2036
+  Value *Subtract = Builder.CreateSub(And1, And2);
+  Value *Res = Builder.CreateSExtOrTrunc(Subtract, Builder.getInt32Ty());
You might want to special-case "memcmp(...) == 0", like we do in SelectionDAGBuilder.


More information about the llvm-commits mailing list