diff --git a/llvm/include/llvm/Analysis/AssumeBundleQueries.h b/llvm/include/llvm/Analysis/AssumeBundleQueries.h --- a/llvm/include/llvm/Analysis/AssumeBundleQueries.h +++ b/llvm/include/llvm/Analysis/AssumeBundleQueries.h @@ -142,7 +142,7 @@ /// /// the argument to the call of llvm.assume may still be useful even if the /// function returned true. -bool isAssumeWithEmptyBundle(AssumeInst &Assume); +bool isAssumeWithEmptyBundle(const AssumeInst &Assume); /// Return a valid Knowledge associated to the Use U if its Attribute kind is /// in AttrKinds. diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h --- a/llvm/include/llvm/Transforms/Utils/Local.h +++ b/llvm/include/llvm/Transforms/Utils/Local.h @@ -76,7 +76,7 @@ /// Return true if the result produced by the instruction would have no side /// effects if it was not used. This is equivalent to checking whether /// isInstructionTriviallyDead would be true if the use count was 0. -bool wouldInstructionBeTriviallyDead(Instruction *I, +bool wouldInstructionBeTriviallyDead(const Instruction *I, const TargetLibraryInfo *TLI = nullptr); /// Return true if the result produced by the instruction has no side effects on diff --git a/llvm/lib/Analysis/AssumeBundleQueries.cpp b/llvm/lib/Analysis/AssumeBundleQueries.cpp --- a/llvm/lib/Analysis/AssumeBundleQueries.cpp +++ b/llvm/lib/Analysis/AssumeBundleQueries.cpp @@ -122,7 +122,7 @@ return getKnowledgeFromBundle(Assume, BOI); } -bool llvm::isAssumeWithEmptyBundle(AssumeInst &Assume) { +bool llvm::isAssumeWithEmptyBundle(const AssumeInst &Assume) { return none_of(Assume.bundle_op_infos(), [](const CallBase::BundleOpInfo &BOI) { return BOI.Tag->getKey() != IgnoreBundleTag; diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -414,7 +414,7 @@ return wouldInstructionBeTriviallyDead(I, TLI); } -bool llvm::wouldInstructionBeTriviallyDead(Instruction *I, +bool llvm::wouldInstructionBeTriviallyDead(const Instruction *I, const TargetLibraryInfo *TLI) { if (I->isTerminator()) return false; @@ -428,7 +428,7 @@ if (isa(I)) return false; - if (DbgLabelInst *DLI = dyn_cast(I)) { + if (const DbgLabelInst *DLI = dyn_cast(I)) { if (DLI->getLabel()) return false; return true; @@ -461,7 +461,7 @@ // Special case intrinsics that "may have side effects" but can be deleted // when dead. - if (IntrinsicInst *II = dyn_cast(I)) { + if (const IntrinsicInst *II = dyn_cast(I)) { // Safe to delete llvm.stacksave and launder.invariant.group if dead. if (II->getIntrinsicID() == Intrinsic::stacksave || II->getIntrinsicID() == Intrinsic::launder_invariant_group)