[PATCH] D157834: [Local] Mark Instruction argument of wouldInstructionBeTriviallyDead as const. NFC.

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 01:08:12 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG06dfc8400d2b: [Local] Mark Instruction argument of wouldInstructionBeTriviallyDead as const. (authored by skatkov).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157834

Files:
  llvm/include/llvm/Analysis/AssumeBundleQueries.h
  llvm/include/llvm/Transforms/Utils/Local.h
  llvm/lib/Analysis/AssumeBundleQueries.cpp
  llvm/lib/Transforms/Utils/Local.cpp


Index: llvm/lib/Transforms/Utils/Local.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Local.cpp
+++ 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<DbgVariableIntrinsic>(I))
     return false;
 
-  if (DbgLabelInst *DLI = dyn_cast<DbgLabelInst>(I)) {
+  if (const DbgLabelInst *DLI = dyn_cast<DbgLabelInst>(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<IntrinsicInst>(I)) {
+  if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
     // Safe to delete llvm.stacksave and launder.invariant.group if dead.
     if (II->getIntrinsicID() == Intrinsic::stacksave ||
         II->getIntrinsicID() == Intrinsic::launder_invariant_group)
Index: llvm/lib/Analysis/AssumeBundleQueries.cpp
===================================================================
--- llvm/lib/Analysis/AssumeBundleQueries.cpp
+++ 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;
Index: llvm/include/llvm/Transforms/Utils/Local.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/Local.h
+++ 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
Index: llvm/include/llvm/Analysis/AssumeBundleQueries.h
===================================================================
--- llvm/include/llvm/Analysis/AssumeBundleQueries.h
+++ 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157834.549816.patch
Type: text/x-patch
Size: 3079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230814/fef774ca/attachment.bin>


More information about the llvm-commits mailing list