While converting an aggregate to scalare, ignore and remove aggregate's debug info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66262 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 710bdfb..f45d4a4 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -1362,7 +1362,11 @@
       IsNotTrivial = true;
       continue;
     }
-    
+
+    // Ignore dbg intrinsic.
+    if (isa<DbgInfoIntrinsic>(User))
+      continue;
+
     // Otherwise, we cannot handle this!
     return false;
   }
@@ -1442,8 +1446,13 @@
       MSI->eraseFromParent();
       continue;
     }
-        
-    
+
+    // If user is a dbg info intrinsic then it is safe to remove it.
+    if (isa<DbgInfoIntrinsic>(User)) {
+      User->eraseFromParent();
+      continue;
+    }
+
     assert(0 && "Unsupported operation!");
     abort();
   }