[llvm] [CodeGen] Gate rematerializer unit tests on AMDGPU target (PR #202966)

Lucas Ramirez via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 06:30:51 PDT 2026


https://github.com/lucas-rami created https://github.com/llvm/llvm-project/pull/202966

Issue introduced in #197575. Initialization functions for the AMDGPU target only work if the target is enabled.

>From 3d0152e684aa6d9d3dcbbc715966f60f5fcf7c60 Mon Sep 17 00:00:00 2001
From: Lucas Ramirez <lucas.rami at proton.me>
Date: Wed, 10 Jun 2026 13:27:03 +0000
Subject: [PATCH] Add missing #if around test set-up

---
 llvm/unittests/CodeGen/RematerializerTest.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/unittests/CodeGen/RematerializerTest.cpp b/llvm/unittests/CodeGen/RematerializerTest.cpp
index 771ce62849eb9..93293f8924b2c 100644
--- a/llvm/unittests/CodeGen/RematerializerTest.cpp
+++ b/llvm/unittests/CodeGen/RematerializerTest.cpp
@@ -93,9 +93,11 @@ struct RematerializerWrapper {
 class RematerializerTest : public CodeGenTestBase {
 public:
   static void SetUpTestCase() {
+#if LLVM_HAS_AMDGPU_TARGET
     LLVMInitializeAMDGPUTargetInfo();
     LLVMInitializeAMDGPUTarget();
     LLVMInitializeAMDGPUTargetMC();
+#endif
   }
 
   void SetUp() override { setUpImpl("amdgcn--", "gfx950", ""); }



More information about the llvm-commits mailing list