[unittests] Change operands of Add in AsmWriterTest from Undef to Poison
authorManuel Brito <manuel.brito@tecnico.ulisboa.pt>
Thu, 8 Sep 2022 10:35:59 +0000 (11:35 +0100)
committerNuno Lopes <nuno.lopes@tecnico.ulisboa.pt>
Thu, 8 Sep 2022 10:37:09 +0000 (11:37 +0100)
Replacing UndefValue with PoisonValue in this test where it's use as dummy value
in light of the efforts to remove undef from llvm.

Differential Revision: https://reviews.llvm.org/D133481

llvm/unittests/IR/AsmWriterTest.cpp

index 4fa1889..c8b5379 100644 (file)
@@ -24,14 +24,14 @@ TEST(AsmWriterTest, DebugPrintDetachedInstruction) {
   // has metadata attached but no parent.
   LLVMContext Ctx;
   auto Ty = Type::getInt32Ty(Ctx);
-  auto Undef = UndefValue::get(Ty);
-  std::unique_ptr<BinaryOperator> Add(BinaryOperator::CreateAdd(Undef, Undef));
+  auto Poison = PoisonValue::get(Ty);
+  std::unique_ptr<BinaryOperator> Add(BinaryOperator::CreateAdd(Poison, Poison));
   Add->setMetadata(
       "", MDNode::get(Ctx, {ConstantAsMetadata::get(ConstantInt::get(Ty, 1))}));
   std::string S;
   raw_string_ostream OS(S);
   Add->print(OS);
-  std::size_t r = OS.str().find("<badref> = add i32 undef, undef, !<empty");
+  std::size_t r = OS.str().find("<badref> = add i32 poison, poison, !<empty");
   EXPECT_TRUE(r != std::string::npos);
 }