[PATCH] D49337: Skip debuginfo intrinsic in markLiveBlocks.

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 14 09:54:26 PDT 2018


trentxintong updated this revision to Diff 155559.
trentxintong added a comment.

Address some of @hfinkel suggestions.

This brings ~25ms now out of ~20s spent to compile sqlite3.c.


Repository:
  rL LLVM

https://reviews.llvm.org/D49337

Files:
  lib/Transforms/Utils/Local.cpp


Index: lib/Transforms/Utils/Local.cpp
===================================================================
--- lib/Transforms/Utils/Local.cpp
+++ lib/Transforms/Utils/Local.cpp
@@ -2020,16 +2020,23 @@
       // Also, if the condition is undefined, then we make the choice most
       // beneficial to the optimizer, and choose that to also be unreachable.
       if (auto *II = dyn_cast<IntrinsicInst>(&I)) {
-        if (II->getIntrinsicID() == Intrinsic::assume) {
+        auto IntrinsicID = II->getIntrinsicID();
+        // Skip debug info intrinsics.
+        if (IntrinsicID == Intrinsic::dbg_addr ||
+            IntrinsicID == Intrinsic::dbg_value ||
+            IntrinsicID == Intrinsic::dbg_declare ||
+            IntrinsicID == Intrinsic::dbg_label)
+          continue;
+        if (IntrinsicID == Intrinsic::assume) {
           if (match(II->getArgOperand(0), m_CombineOr(m_Zero(), m_Undef()))) {
             // Don't insert a call to llvm.trap right before the unreachable.
             changeToUnreachable(II, false, false, DDT);
             Changed = true;
             break;
           }
         }
 
-        if (II->getIntrinsicID() == Intrinsic::experimental_guard) {
+        if (IntrinsicID == Intrinsic::experimental_guard) {
           // A call to the guard intrinsic bails out of the current compilation
           // unit if the predicate passed to it is false.  If the predicate is a
           // constant false, then we know the guard will bail out of the current
@@ -2068,12 +2075,11 @@
           }
           break;
         }
-      }
+      } else if (auto *SI = dyn_cast<StoreInst>(&I)) {
+        // Store to undef and store to null are undefined and used to signal
+        // that they should be changed to unreachable by passes that can't
+        // modify the CFG.
 
-      // Store to undef and store to null are undefined and used to signal that
-      // they should be changed to unreachable by passes that can't modify the
-      // CFG.
-      if (auto *SI = dyn_cast<StoreInst>(&I)) {
         // Don't touch volatile stores.
         if (SI->isVolatile()) continue;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49337.155559.patch
Type: text/x-patch
Size: 2124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180714/e2fefca6/attachment.bin>


More information about the llvm-commits mailing list