[PATCH] D78395: [llvm][NFC][CallSite] Remove CallSite from Evaluator.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 13:32:28 PDT 2020


dblaikie accepted this revision.
dblaikie added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Transforms/Utils/Evaluator.cpp:267-269
+Evaluator::getCalleeWithFormalArgs(CallBase *CB,
                                    SmallVector<Constant *, 8> &Formals) {
+  auto *V = CB->getCalledValue();
----------------
Looks like this could pass by reference, rather than pointer (since it unconditionally dereferences in the implementation)


================
Comment at: llvm/lib/Transforms/Utils/Evaluator.cpp:282
 
-bool Evaluator::getFormalParams(CallSite &CS, Function *F,
+bool Evaluator::getFormalParams(CallBase *CB, Function *F,
                                 SmallVector<Constant *, 8> &Formals) {
----------------
This one's less clear - up to you if you want to look closer to figure out if it could be reference. (the only issue is whether callers actually need to pass null CB when they pass null F - if they still pass non-null CB when F is null, then CB might as well be a reference)


================
Comment at: llvm/lib/Transforms/Utils/Evaluator.cpp:571
+        if (Constant *C =
+                ConstantFoldCall(cast<CallBase>(CB), Callee, Formals, TLI)) {
+          InstResult = castCallResultIfNeeded(CB->getCalledValue(), C);
----------------
No need for the cast here, since CB is already a CallBase?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78395





More information about the llvm-commits mailing list