diff options
| author | Brian Gesiak <modocache@gmail.com> | 2020-01-01 20:24:14 -0500 |
|---|---|---|
| committer | Brian Gesiak <modocache@gmail.com> | 2020-01-01 21:57:49 -0500 |
| commit | 9ce0ff2eefcd9e41fa59a6a6aadbb7fd1de87f34 (patch) | |
| tree | 74ef2603c08c6a6dcdc7f444c2277823f660f33b | |
| parent | 0b7b21dce46572c335c0d94b0f24464611389a36 (diff) | |
| download | bcm5719-llvm-9ce0ff2eefcd9e41fa59a6a6aadbb7fd1de87f34.tar.gz bcm5719-llvm-9ce0ff2eefcd9e41fa59a6a6aadbb7fd1de87f34.zip | |
[Coroutines] const-ify internal helpers (NFC)
Several helpers internal to llvm/Transforms/Coroutines do not use
'const' for parameters that are not modified. Add const where possible.
| -rw-r--r-- | llvm/lib/Transforms/Coroutines/CoroInternal.h | 3 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Coroutines/CoroSplit.cpp | 17 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Coroutines/Coroutines.cpp | 4 |
3 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Coroutines/CoroInternal.h b/llvm/lib/Transforms/Coroutines/CoroInternal.h index 9f39ff2babf..7eb35400c0d 100644 --- a/llvm/lib/Transforms/Coroutines/CoroInternal.h +++ b/llvm/lib/Transforms/Coroutines/CoroInternal.h @@ -43,7 +43,8 @@ void initializeCoroCleanupLegacyPass(PassRegistry &); namespace coro { -bool declaresIntrinsics(Module &M, std::initializer_list<StringRef>); +bool declaresIntrinsics(const Module &M, + const std::initializer_list<StringRef>); void replaceAllCoroAllocs(CoroBeginInst *CB, bool Replacement); void replaceAllCoroFrees(CoroBeginInst *CB, Value *Replacement); void replaceCoroFree(CoroIdInst *CoroId, bool Elide); diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 5cda1352beb..ee4a1f36d70 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -158,8 +158,9 @@ private: } // end anonymous namespace -static void maybeFreeRetconStorage(IRBuilder<> &Builder, coro::Shape &Shape, - Value *FramePtr, CallGraph *CG) { +static void maybeFreeRetconStorage(IRBuilder<> &Builder, + const coro::Shape &Shape, Value *FramePtr, + CallGraph *CG) { assert(Shape.ABI == coro::ABI::Retcon || Shape.ABI == coro::ABI::RetconOnce); if (Shape.RetconLowering.IsFrameInlineInStorage) @@ -169,9 +170,9 @@ static void maybeFreeRetconStorage(IRBuilder<> &Builder, coro::Shape &Shape, } /// Replace a non-unwind call to llvm.coro.end. -static void replaceFallthroughCoroEnd(CoroEndInst *End, coro::Shape &Shape, - Value *FramePtr, bool InResume, - CallGraph *CG) { +static void replaceFallthroughCoroEnd(CoroEndInst *End, + const coro::Shape &Shape, Value *FramePtr, + bool InResume, CallGraph *CG) { // Start inserting right before the coro.end. IRBuilder<> Builder(End); @@ -219,7 +220,7 @@ static void replaceFallthroughCoroEnd(CoroEndInst *End, coro::Shape &Shape, } /// Replace an unwind call to llvm.coro.end. -static void replaceUnwindCoroEnd(CoroEndInst *End, coro::Shape &Shape, +static void replaceUnwindCoroEnd(CoroEndInst *End, const coro::Shape &Shape, Value *FramePtr, bool InResume, CallGraph *CG){ IRBuilder<> Builder(End); @@ -246,7 +247,7 @@ static void replaceUnwindCoroEnd(CoroEndInst *End, coro::Shape &Shape, } } -static void replaceCoroEnd(CoroEndInst *End, coro::Shape &Shape, +static void replaceCoroEnd(CoroEndInst *End, const coro::Shape &Shape, Value *FramePtr, bool InResume, CallGraph *CG) { if (End->isUnwind()) replaceUnwindCoroEnd(End, Shape, FramePtr, InResume, CG); @@ -782,7 +783,7 @@ static Function *createClone(Function &F, const Twine &Suffix, } /// Remove calls to llvm.coro.end in the original function. -static void removeCoroEnds(coro::Shape &Shape, CallGraph *CG) { +static void removeCoroEnds(const coro::Shape &Shape, CallGraph *CG) { for (auto End : Shape.CoroEnds) { replaceCoroEnd(End, Shape, Shape.FramePtr, /*in resume*/ false, CG); } diff --git a/llvm/lib/Transforms/Coroutines/Coroutines.cpp b/llvm/lib/Transforms/Coroutines/Coroutines.cpp index b4b3cd082a1..02d11af3303 100644 --- a/llvm/lib/Transforms/Coroutines/Coroutines.cpp +++ b/llvm/lib/Transforms/Coroutines/Coroutines.cpp @@ -151,8 +151,8 @@ static bool isCoroutineIntrinsicName(StringRef Name) { // Verifies if a module has named values listed. Also, in debug mode verifies // that names are intrinsic names. -bool coro::declaresIntrinsics(Module &M, - std::initializer_list<StringRef> List) { +bool coro::declaresIntrinsics(const Module &M, + const std::initializer_list<StringRef> List) { for (StringRef Name : List) { assert(isCoroutineIntrinsicName(Name) && "not a coroutine intrinsic"); if (M.getNamedValue(Name)) |

