[PATCH] D69496: Attributor: Move list of opcodes

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 27 18:12:50 PDT 2019


arsenm created this revision.
arsenm added a reviewer: jdoerfert.
Herald added subscribers: hiraditya, wdng.
Herald added a project: LLVM.

This is reusable between different attributes.


https://reviews.llvm.org/D69496

Files:
  llvm/lib/Transforms/IPO/Attributor.cpp


Index: llvm/lib/Transforms/IPO/Attributor.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Attributor.cpp
+++ llvm/lib/Transforms/IPO/Attributor.cpp
@@ -136,6 +136,12 @@
 static cl::opt<int> MaxHeapToStackSize("max-heap-to-stack-size", cl::init(128),
                                        cl::Hidden);
 
+static const unsigned CallLikeOpcodes[] = {
+  Instruction::Invoke,      Instruction::CallBr,
+  Instruction::Call,        Instruction::CleanupRet,
+  Instruction::CatchSwitch, Instruction::Resume
+};
+
 /// Logic operators for the change status enum class.
 ///
 ///{
@@ -788,11 +794,6 @@
 
   /// See AbstractAttribute::updateImpl(...).
   ChangeStatus updateImpl(Attributor &A) override {
-    auto Opcodes = {
-        (unsigned)Instruction::Invoke,      (unsigned)Instruction::CallBr,
-        (unsigned)Instruction::Call,        (unsigned)Instruction::CleanupRet,
-        (unsigned)Instruction::CatchSwitch, (unsigned)Instruction::Resume};
-
     auto CheckForNoUnwind = [&](Instruction &I) {
       if (!I.mayThrow())
         return true;
@@ -805,7 +806,7 @@
       return false;
     };
 
-    if (!A.checkForAllInstructions(CheckForNoUnwind, *this, Opcodes))
+    if (!A.checkForAllInstructions(CheckForNoUnwind, *this, CallLikeOpcodes))
       return indicatePessimisticFixpoint();
 
     return ChangeStatus::UNCHANGED;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69496.226607.patch
Type: text/x-patch
Size: 1391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191028/66fd243c/attachment.bin>


More information about the llvm-commits mailing list