From 363ac6837427ffc6adcc68c44788bb4d92d52873 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 7 Jan 2019 05:42:51 +0000 Subject: [CallSite removal] Migrate all Alias Analysis APIs to use the newly minted `CallBase` class instead of the `CallSite` wrapper. This moves the largest interwoven collection of APIs that traffic in `CallSite`s. While a handful of these could have been migrated with a minorly more shallow migration by converting from a `CallSite` to a `CallBase`, it hardly seemed worth it. Most of the APIs needed to migrate together because of the complex interplay of AA APIs and the fact that converting from a `CallBase` to a `CallSite` isn't free in its current implementation. Out of tree users of these APIs can fairly reliably migrate with some combination of `.getInstruction()` on the `CallSite` instance and casting the resulting pointer. The most generic form will look like `CS` -> `cast_or_null(CS.getInstruction())` but in most cases there is a more elegant migration. Hopefully, this migrates enough APIs for users to fully move from `CallSite` to the base class. All of the in-tree users were easily migrated in that fashion. Thanks for the review from Saleem! Differential Revision: https://reviews.llvm.org/D55641 llvm-svn: 350503 --- llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp') diff --git a/llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp b/llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp index f48d3cc098a..83861b98fbd 100644 --- a/llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp +++ b/llvm/lib/Transforms/Scalar/LoopVersioningLICM.cpp @@ -360,10 +360,11 @@ bool LoopVersioningLICM::legalLoopMemoryAccesses() { bool LoopVersioningLICM::instructionSafeForVersioning(Instruction *I) { assert(I != nullptr && "Null instruction found!"); // Check function call safety - if (isa(I) && !AA->doesNotAccessMemory(CallSite(I))) { - LLVM_DEBUG(dbgs() << " Unsafe call site found.\n"); - return false; - } + if (auto *Call = dyn_cast(I)) + if (!AA->doesNotAccessMemory(Call)) { + LLVM_DEBUG(dbgs() << " Unsafe call site found.\n"); + return false; + } // Avoid loops with possiblity of throw if (I->mayThrow()) { LLVM_DEBUG(dbgs() << " May throw instruction found in loop body\n"); -- cgit v1.2.3