summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Transforms
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-08 00:56:21 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-08 00:56:21 +0000
commit805873148afbbbd2a377340ec647a6c838570aa5 (patch)
tree48cf6908a338429adfb3c42dd679f305af223f36 /llvm/unittests/Transforms
parente57546de4044418342431e79b2dea72f971306db (diff)
downloadbcm5719-llvm-805873148afbbbd2a377340ec647a6c838570aa5.tar.gz
bcm5719-llvm-805873148afbbbd2a377340ec647a6c838570aa5.zip
Revert "ValueMapper: Treat LocalAsMetadata more like function-local Values"
This reverts commit r265759, since even this limited version breaks some bots: http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/3311 http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/17696 This also reverts r265761 "ValueMapper: Unduplicate RF_NoModuleLevelChanges check, NFC", since I had trouble separating it from r265759. llvm-svn: 265765
Diffstat (limited to 'llvm/unittests/Transforms')
-rw-r--r--llvm/unittests/Transforms/Utils/ValueMapperTest.cpp95
1 files changed, 0 insertions, 95 deletions
diff --git a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
index 151f76da9cb..222f2a2e863 100644
--- a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
+++ b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
@@ -139,99 +139,4 @@ TEST(ValueMapperTest, MapMetadataNullMapGlobalWithIgnoreMissingLocals) {
EXPECT_EQ(nullptr, MapValue(F.get(), VM, Flags));
}
-TEST(ValueMapperTest, MapMetadataConstantAsMetadata) {
- LLVMContext C;
- FunctionType *FTy =
- FunctionType::get(Type::getVoidTy(C), Type::getInt8Ty(C), false);
- std::unique_ptr<Function> F(
- Function::Create(FTy, GlobalValue::ExternalLinkage, "F"));
-
- auto *CAM = ConstantAsMetadata::get(F.get());
- {
- ValueToValueMapTy VM;
- EXPECT_EQ(CAM, MapMetadata(CAM, VM));
- EXPECT_TRUE(VM.MD().count(CAM));
- VM.MD().erase(CAM);
- EXPECT_EQ(CAM, MapMetadata(CAM, VM, RF_IgnoreMissingLocals));
- EXPECT_TRUE(VM.MD().count(CAM));
-
- auto *N = MDTuple::get(C, None);
- VM.MD()[CAM].reset(N);
- EXPECT_EQ(N, MapMetadata(CAM, VM));
- EXPECT_EQ(N, MapMetadata(CAM, VM, RF_IgnoreMissingLocals));
- }
-
- std::unique_ptr<Function> F2(
- Function::Create(FTy, GlobalValue::ExternalLinkage, "F2"));
- ValueToValueMapTy VM;
- VM[F.get()] = F2.get();
- auto *F2MD = MapMetadata(CAM, VM);
- EXPECT_TRUE(VM.MD().count(CAM));
- EXPECT_TRUE(F2MD);
- EXPECT_EQ(F2.get(), cast<ConstantAsMetadata>(F2MD)->getValue());
-}
-
-#ifdef GTEST_HAS_DEATH_TEST
-#ifndef NDEBUG
-TEST(ValueMapperTest, MapMetadataLocalAsMetadata) {
- LLVMContext C;
- FunctionType *FTy =
- FunctionType::get(Type::getVoidTy(C), Type::getInt8Ty(C), false);
- std::unique_ptr<Function> F(
- Function::Create(FTy, GlobalValue::ExternalLinkage, "F"));
- Argument &A = *F->arg_begin();
-
- // MapMetadata doesn't support LocalAsMetadata. The only valid container for
- // LocalAsMetadata is a MetadataAsValue instance, so use it directly.
- auto *LAM = LocalAsMetadata::get(&A);
- ValueToValueMapTy VM;
- EXPECT_DEATH(MapMetadata(LAM, VM), "Unexpected local metadata");
- EXPECT_DEATH(MapMetadata(LAM, VM, RF_IgnoreMissingLocals),
- "Unexpected local metadata");
-}
-#endif
-#endif
-
-TEST(ValueMapperTest, MapValueLocalAsMetadata) {
- LLVMContext C;
- FunctionType *FTy =
- FunctionType::get(Type::getVoidTy(C), Type::getInt8Ty(C), false);
- std::unique_ptr<Function> F(
- Function::Create(FTy, GlobalValue::ExternalLinkage, "F"));
- Argument &A = *F->arg_begin();
-
- auto *LAM = LocalAsMetadata::get(&A);
- auto *MAV = MetadataAsValue::get(C, LAM);
-
- // The principled answer to a LocalAsMetadata of an unmapped SSA value would
- // be to return nullptr (regardless of RF_IgnoreMissingLocals).
- //
- // However, algorithms that use RemapInstruction assume that each instruction
- // only references SSA values from previous instructions. Arguments of
- // such as "metadata i32 %x" don't currently successfully maintain that
- // property. To keep RemapInstruction from crashing we need a non-null
- // return here, but we also shouldn't reference the unmapped local. Use
- // "metadata !{}".
- auto *N0 = MDTuple::get(C, None);
- auto *N0AV = MetadataAsValue::get(C, N0);
- ValueToValueMapTy VM;
- EXPECT_EQ(N0AV, MapValue(MAV, VM));
- EXPECT_EQ(nullptr, MapValue(MAV, VM, RF_IgnoreMissingLocals));
- EXPECT_FALSE(VM.count(MAV));
- EXPECT_FALSE(VM.count(&A));
- EXPECT_EQ(None, VM.getMappedMD(LAM));
-
- VM[MAV] = MAV;
- EXPECT_EQ(MAV, MapValue(MAV, VM));
- EXPECT_EQ(MAV, MapValue(MAV, VM, RF_IgnoreMissingLocals));
- EXPECT_TRUE(VM.count(MAV));
- EXPECT_FALSE(VM.count(&A));
-
- VM[MAV] = &A;
- EXPECT_EQ(&A, MapValue(MAV, VM));
- EXPECT_EQ(&A, MapValue(MAV, VM, RF_IgnoreMissingLocals));
- EXPECT_TRUE(VM.count(MAV));
- EXPECT_FALSE(VM.count(&A));
-}
-
} // end namespace
OpenPOWER on IntegriCloud