diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-17 01:14:40 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-17 01:14:40 +0000 |
commit | 170c26d75eb1fb0e8c3c0ae7107ab971bc61e64b (patch) | |
tree | dc324d79cff8b93f1c7e468583060761ad7a2b92 /llvm/unittests/Transforms | |
parent | cc6b381651f23b572db15b8bf9df4bcff62edc57 (diff) | |
download | bcm5719-llvm-170c26d75eb1fb0e8c3c0ae7107ab971bc61e64b.tar.gz bcm5719-llvm-170c26d75eb1fb0e8c3c0ae7107ab971bc61e64b.zip |
MapMetadata: Allow unresolved metadata if it won't change
Allow unresolved nodes through the `MapMetadata()` if
`RF_NoModuleLevelChanges`, since there's no remapping to do anyway.
This fixes PR22929. I'll add a clang test as a follow-up.
llvm-svn: 232449
Diffstat (limited to 'llvm/unittests/Transforms')
-rw-r--r-- | llvm/unittests/Transforms/Utils/CMakeLists.txt | 1 | ||||
-rw-r--r-- | llvm/unittests/Transforms/Utils/ValueMapperTest.cpp | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/llvm/unittests/Transforms/Utils/CMakeLists.txt b/llvm/unittests/Transforms/Utils/CMakeLists.txt index ffa1d49d380..517ff99ea46 100644 --- a/llvm/unittests/Transforms/Utils/CMakeLists.txt +++ b/llvm/unittests/Transforms/Utils/CMakeLists.txt @@ -9,4 +9,5 @@ add_llvm_unittest(UtilsTests Cloning.cpp IntegerDivision.cpp Local.cpp + ValueMapperTest.cpp ) diff --git a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp new file mode 100644 index 00000000000..137a2607c84 --- /dev/null +++ b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp @@ -0,0 +1,27 @@ +//===- ValueMapper.cpp - Unit tests for ValueMapper -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/IR/LLVMContext.h" +#include "llvm/IR/Metadata.h" +#include "llvm/Transforms/Utils/ValueMapper.h" +#include "gtest/gtest.h" + +using namespace llvm; + +namespace { + +TEST(ValueMapperTest, MapMetadataUnresolved) { + LLVMContext Context; + TempMDTuple T = MDTuple::getTemporary(Context, None); + + ValueToValueMapTy VM; + EXPECT_EQ(T.get(), MapMetadata(T.get(), VM, RF_NoModuleLevelChanges)); +} + +} |