[PATCH] D32241: Don't process debug intrinsics in InstCombine

Dmitry Mikulin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 15:08:59 PDT 2017


dmikulin updated this revision to Diff 95831.
dmikulin added a comment.

We can skip debug intrinsics from adding them to the InstCombine worklist.
With this change I can create a test case. And it shaves a few more seconds off compile time.


https://reviews.llvm.org/D32241

Files:
  include/llvm/Transforms/InstCombine/InstCombineWorklist.h


Index: include/llvm/Transforms/InstCombine/InstCombineWorklist.h
===================================================================
--- include/llvm/Transforms/InstCombine/InstCombineWorklist.h
+++ include/llvm/Transforms/InstCombine/InstCombineWorklist.h
@@ -14,6 +14,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/Instruction.h"
+#include "llvm/IR/IntrinsicInst.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
@@ -39,7 +40,7 @@
   /// Add - Add the specified instruction to the worklist if it isn't already
   /// in it.
   void Add(Instruction *I) {
-    if (WorklistMap.insert(std::make_pair(I, Worklist.size())).second) {
+    if (!isa<DbgInfoIntrinsic>(I) && WorklistMap.insert(std::make_pair(I, Worklist.size())).second) {
       DEBUG(dbgs() << "IC: ADD: " << *I << '\n');
       Worklist.push_back(I);
     }
@@ -60,8 +61,10 @@
     DEBUG(dbgs() << "IC: ADDING: " << List.size() << " instrs to worklist\n");
     unsigned Idx = 0;
     for (Instruction *I : reverse(List)) {
-      WorklistMap.insert(std::make_pair(I, Idx++));
-      Worklist.push_back(I);
+      if (!isa<DbgInfoIntrinsic>(I)) {
+        WorklistMap.insert(std::make_pair(I, Idx++));
+        Worklist.push_back(I);
+      }
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32241.95831.patch
Type: text/x-patch
Size: 1326 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170419/fb63a1ea/attachment.bin>


More information about the llvm-commits mailing list