diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-04-16 03:39:44 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-04-16 03:39:44 +0000 |
| commit | a77d073305acde5afa0b61daf3fe1a823ed8ad81 (patch) | |
| tree | 73443ec4b64969cb1f80902f3538b2c412c64335 /llvm/unittests/Transforms/Utils/ValueMapperTest.cpp | |
| parent | 0d2ef0158926973d6a977d71de5cc455cff2599a (diff) | |
| download | llvm-a77d073305acde5afa0b61daf3fe1a823ed8ad81.zip llvm-a77d073305acde5afa0b61daf3fe1a823ed8ad81.tar.gz llvm-a77d073305acde5afa0b61daf3fe1a823ed8ad81.tar.bz2 | |
ValueMapper: Stop memoizing ConstantAsMetadata
Stop memoizing ConstantAsMetadata in ValueMapper::mapMetadata. Now we
have to recompute it, but these metadata aren't particularly common, and
it restricts the lifetime of the Metadata map unnecessarily.
(The motivation is that I have a patch which uses a single Metadata map
for the lifetime of IRMover. Mehdi profiled r266446 with the patch
applied and we saw a pretty big speedup in lib/Linker.)
llvm-svn: 266513
Diffstat (limited to 'llvm/unittests/Transforms/Utils/ValueMapperTest.cpp')
| -rw-r--r-- | llvm/unittests/Transforms/Utils/ValueMapperTest.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp index 2c6d45a..34b62bb 100644 --- a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp +++ b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp @@ -238,13 +238,14 @@ TEST(ValueMapperTest, mapMetadataConstantAsMetadata) { auto *CAM = ConstantAsMetadata::get(F.get()); { + // ConstantAsMetadata shouldn't be memoized. ValueToValueMapTy VM; EXPECT_EQ(CAM, ValueMapper(VM).mapMetadata(*CAM)); - EXPECT_TRUE(VM.MD().count(CAM)); - VM.MD().erase(CAM); + EXPECT_FALSE(VM.MD().count(CAM)); EXPECT_EQ(CAM, ValueMapper(VM, RF_IgnoreMissingLocals).mapMetadata(*CAM)); - EXPECT_TRUE(VM.MD().count(CAM)); + EXPECT_FALSE(VM.MD().count(CAM)); + // But it should respect a mapping that gets seeded. auto *N = MDTuple::get(C, None); VM.MD()[CAM].reset(N); EXPECT_EQ(N, ValueMapper(VM).mapMetadata(*CAM)); @@ -256,7 +257,7 @@ TEST(ValueMapperTest, mapMetadataConstantAsMetadata) { ValueToValueMapTy VM; VM[F.get()] = F2.get(); auto *F2MD = ValueMapper(VM).mapMetadata(*CAM); - EXPECT_TRUE(VM.MD().count(CAM)); + EXPECT_FALSE(VM.MD().count(CAM)); EXPECT_TRUE(F2MD); EXPECT_EQ(F2.get(), cast<ConstantAsMetadata>(F2MD)->getValue()); } |
