[PATCH] D62358: [SimplifyLibCalls] Fold more fortified builtin functions into their non-fortified variants when possible

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 18:12:40 PDT 2019

jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

I added some minor comments but other than that I think it is fine.
I would, however, prefer it if you could split the patch up when you commit it so that the generalization of the builder is separated from the new fortified libcalls and their optimization.

Comment at: llvm/include/llvm/Transforms/Utils/BuildLibCalls.h:109
+  Value *emitMemCCpy(Value *Ptr1, Value *Ptr2, Value *Val, Value *Len,
+                     IRBuilder<> &B, const TargetLibraryInfo *TLI);
Any reason you didn't add comments here?

Comment at: llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h:59
   Value *optimizeMemSetChk(CallInst *CI, IRBuilder<> &B);
-  // Str/Stp cpy are similar enough to be handled in the same functions.
+  /// Str/Stp cpy are similar enough to be handled in the same functions.
   Value *optimizeStrpCpyChk(CallInst *CI, IRBuilder<> &B, LibFunc Func);
Newline removed.

Comment at: llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h:74
   /// to the non-fortified version.
+  ///
+  /// \param SizeOp optionally set to the parameter index of an explicit buffer
When you add parameter descriptions, could you add it for all five parameters?

Comment at: llvm/lib/Transforms/Utils/BuildLibCalls.cpp:792
+static Value *emitLibCall(LibFunc TheLibFunc, Type *ReturnType,
+                          ArrayRef<Type *> ParamTypes,
This can be commited separately.




More information about the llvm-commits mailing list