[llvm] [AMDGPU] Initialize MachineFunctionInfo for unittest (PR #91820)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 10 15:16:43 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mc
@llvm/pr-subscribers-backend-amdgpu
Author: Janek van Oirschot (JanekvO)
<details>
<summary>Changes</summary>
Initializes the MachineFunctionInfo for unittest introduced in #<!-- -->88257
Should fix the sanitizer buildbot: https://lab.llvm.org/buildbot/#/builders/5
---
Full diff: https://github.com/llvm/llvm-project/pull/91820.diff
1 Files Affected:
- (modified) llvm/unittests/MC/AMDGPU/SIProgramInfoMCExprs.cpp (+8-2)
``````````diff
diff --git a/llvm/unittests/MC/AMDGPU/SIProgramInfoMCExprs.cpp b/llvm/unittests/MC/AMDGPU/SIProgramInfoMCExprs.cpp
index f2161f71e6e99..912974fa23bdb 100644
--- a/llvm/unittests/MC/AMDGPU/SIProgramInfoMCExprs.cpp
+++ b/llvm/unittests/MC/AMDGPU/SIProgramInfoMCExprs.cpp
@@ -64,6 +64,7 @@ class SIProgramInfoMCExprsTest : public testing::Test {
TM->getTargetFeatureString(), *TM);
MF = std::make_unique<MachineFunction>(*F, *TM, *ST, 1, *MMI);
+ MF->initTargetMachineFunctionInfo(*ST);
PI.reset(*MF.get());
}
};
@@ -76,6 +77,11 @@ TEST_F(SIProgramInfoMCExprsTest, TestDeathHSAKernelEmit) {
auto &Func = MF->getFunction();
Func.setCallingConv(CallingConv::AMDGPU_KERNEL);
AMDGPU::HSAMD::MetadataStreamerMsgPackV4 MD;
- EXPECT_DEATH(MD.emitKernel(*MF, PI),
- "could not resolve expression when required.");
+
+ testing::internal::CaptureStderr();
+ MD.emitKernel(*MF, PI);
+ std::string err = testing::internal::GetCapturedStderr();
+ EXPECT_EQ(
+ err, "<unknown>:0: error: could not resolve expression when required.\n");
+ EXPECT_TRUE(Ctx.hadError());
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/91820
More information about the llvm-commits
mailing list