From 016daa662fad50588be18388a143f334ecd0a5f7 Mon Sep 17 00:00:00 2001 From: Pete Cooper Date: Wed, 13 May 2015 01:12:06 +0000 Subject: [PATCH] Constify arguments to methods in LoopInfo. NFC llvm-svn: 237223 --- llvm/include/llvm/Analysis/LoopInfo.h | 4 ++-- llvm/lib/Analysis/LoopInfo.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h index f3d85e684048..be78c15e7224 100644 --- a/llvm/include/llvm/Analysis/LoopInfo.h +++ b/llvm/include/llvm/Analysis/LoopInfo.h @@ -361,11 +361,11 @@ public: /// isLoopInvariant - Return true if the specified value is loop invariant /// - bool isLoopInvariant(Value *V) const; + bool isLoopInvariant(const Value *V) const; /// hasLoopInvariantOperands - Return true if all the operands of the /// specified instruction are loop invariant. - bool hasLoopInvariantOperands(Instruction *I) const; + bool hasLoopInvariantOperands(const Instruction *I) const; /// makeLoopInvariant - If the given value is an instruction inside of the /// loop and it can be hoisted, do so to make it trivially loop-invariant. diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index b3a33326c00a..09045dcf8e72 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/lib/Analysis/LoopInfo.cpp @@ -56,15 +56,15 @@ static const char *const LoopMDName = "llvm.loop"; /// isLoopInvariant - Return true if the specified value is loop invariant /// -bool Loop::isLoopInvariant(Value *V) const { - if (Instruction *I = dyn_cast(V)) +bool Loop::isLoopInvariant(const Value *V) const { + if (const Instruction *I = dyn_cast(V)) return !contains(I); return true; // All non-instructions are loop invariant } /// hasLoopInvariantOperands - Return true if all the operands of the /// specified instruction are loop invariant. -bool Loop::hasLoopInvariantOperands(Instruction *I) const { +bool Loop::hasLoopInvariantOperands(const Instruction *I) const { for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) if (!isLoopInvariant(I->getOperand(i))) return false;