[PATCH] D77930: [llvm][NFC] Refactor uses of CallSite to CallBase - call promotion

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 11 17:36:37 PDT 2020


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


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUFixFunctionBitcasts.cpp:39
+    if (Callee &&
+        isLegalToPromote(*cast<CallBase>(CS.getInstruction()), Callee)) {
+      promoteCall(*cast<CallBase>(CS.getInstruction()), Callee);
----------------
Hmm, might be worth adding an implicit conversion from CallSite to CallBase* to make code like this easier? (alternatively/at least CallSite::getInstruction() should return CallBase*, I think?)


================
Comment at: llvm/unittests/Transforms/Utils/CallPromotionUtilsTest.cpp:95-98
+  CallBase &CB = *CI;
+  ASSERT_FALSE(CB.getCalledFunction());
+  bool IsPromoted = tryPromoteCall(CB);
   EXPECT_FALSE(IsPromoted);
----------------
Can probably drop the intermediate CB variable now (& just write CI->getCalledFunction() and tryPromoteCall(*CI))

(similarly below)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77930





More information about the llvm-commits mailing list