[PATCH] D78256: [llvm][NFC][CallSite] Removed CallSite from some implementation details.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 17:41:41 PDT 2020


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/FunctionComparator.cpp:54
 int FunctionComparator::cmpNumbers(uint64_t L, uint64_t R) const {
-  if (L < R) return -1;
-  if (L > R) return 1;
+  if (L < R)
+    return -1;
----------------
This looks like an unrelated formatting change?


================
Comment at: llvm/lib/Transforms/Utils/FunctionComparator.cpp:589
     return cmpNumbers(CI->getPredicate(), cast<CmpInst>(R)->getPredicate());
-  if (auto CSL = CallSite(const_cast<Instruction *>(L))) {
-    auto CSR = CallSite(const_cast<Instruction *>(R));
-    if (int Res = cmpNumbers(CSL.getCallingConv(), CSR.getCallingConv()))
+  if (auto *CBL = dyn_cast<CallBase>(const_cast<Instruction *>(L))) {
+    auto *CBR = cast<CallBase>(const_cast<Instruction *>(R));
----------------
Why do we need a const_cast? Aren't getCallingConv and getAttributes() both const methods?


================
Comment at: llvm/tools/opt/AnalysisWrappers.cpp:42
 
-          CallSite CS(cast<Value>(UI));
-          if (!CS) continue;
+          CallBase *CB = (dyn_cast<CallBase>(UI));
+          if (!CB)
----------------
Drop the extra parentheses around the dyn_cast?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78256





More information about the llvm-commits mailing list