summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Transforms/Utils/Cloning.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-03-30 22:05:13 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-03-30 22:05:13 +0000
commit2bc252acd5625cb0fb167f0d9b3fd05292f7cc47 (patch)
tree8e978a0b2303515887b0f9a5919a63d37b5072b1 /llvm/unittests/Transforms/Utils/Cloning.cpp
parent1d46d979a9822239b1d30e8acb70726a69487be1 (diff)
downloadbcm5719-llvm-2bc252acd5625cb0fb167f0d9b3fd05292f7cc47.tar.gz
bcm5719-llvm-2bc252acd5625cb0fb167f0d9b3fd05292f7cc47.zip
Cloning: Reduce complexity of debug info cloning and fix correctness issue.
Commit r260791 contained an error in that it would introduce a cross-module reference in the old module. It also introduced O(N^2) complexity in the module cloner by requiring the entire module to be visited for each function. Fix both of these problems by avoiding use of the CloneDebugInfoMetadata function (which is only designed to do intra-module cloning) and cloning function-attached metadata in the same way that we clone all other metadata. Differential Revision: http://reviews.llvm.org/D18583 llvm-svn: 264935
Diffstat (limited to 'llvm/unittests/Transforms/Utils/Cloning.cpp')
-rw-r--r--llvm/unittests/Transforms/Utils/Cloning.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/unittests/Transforms/Utils/Cloning.cpp b/llvm/unittests/Transforms/Utils/Cloning.cpp
index b761e4e220e..f06a20f1f9e 100644
--- a/llvm/unittests/Transforms/Utils/Cloning.cpp
+++ b/llvm/unittests/Transforms/Utils/Cloning.cpp
@@ -464,6 +464,12 @@ TEST_F(CloneModule, Verify) {
EXPECT_FALSE(verifyModule(*NewM));
}
+TEST_F(CloneModule, OldModuleUnchanged) {
+ DebugInfoFinder Finder;
+ Finder.processModule(*OldM);
+ EXPECT_EQ(1U, Finder.subprogram_count());
+}
+
TEST_F(CloneModule, Subprogram) {
Function *NewF = NewM->getFunction("f");
DISubprogram *SP = NewF->getSubprogram();
OpenPOWER on IntegriCloud