diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-04-07 01:22:45 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-04-07 01:22:45 +0000 |
commit | fdccad925c91aa981c097f51e3790069dcd0a49a (patch) | |
tree | 817a6908fdd6c76bb2160fcbe83acdadfcdfe1f7 /llvm/unittests/Transforms | |
parent | 4775fcfa4ee817e061dcedcb4b47fa5d9e39e53d (diff) | |
download | bcm5719-llvm-fdccad925c91aa981c097f51e3790069dcd0a49a.tar.gz bcm5719-llvm-fdccad925c91aa981c097f51e3790069dcd0a49a.zip |
ValueMapper: Allow RF_IgnoreMissingLocals and RF_NullMapMissingGlobalValues
Remove the assertion that disallowed the combination, since
RF_IgnoreMissingLocals should have no effect on globals. As it happens,
RF_NullMapMissingGlobalValues asserted in MapValue(Constant*,...), so I
also changed a cast to a cast_or_null to get my test passing.
llvm-svn: 265633
Diffstat (limited to 'llvm/unittests/Transforms')
-rw-r--r-- | llvm/unittests/Transforms/Utils/ValueMapperTest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp index 56e407b9e6b..b9cca2292c1 100644 --- a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp +++ b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp @@ -209,4 +209,16 @@ TEST(ValueMapperTest, MapValueLocalAsMetadata) { EXPECT_EQ(&A, MapValue(MAV, VM, RF_IgnoreMissingLocals)); } +TEST(ValueMapperTest, MapMetadataNullMapGlobalWithIgnoreMissingLocals) { + LLVMContext C; + FunctionType *FTy = + FunctionType::get(Type::getVoidTy(C), Type::getInt8Ty(C), false); + std::unique_ptr<Function> F( + Function::Create(FTy, GlobalValue::ExternalLinkage, "F")); + + ValueToValueMapTy VM; + RemapFlags Flags = RF_IgnoreMissingLocals | RF_NullMapMissingGlobalValues; + EXPECT_EQ(nullptr, MapValue(F.get(), VM, Flags)); +} + } // end namespace |