[llvm] [NFC][HLSL] Fix msan errors in tests (PR #212901)
Finn Plummer via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 29 16:50:20 PDT 2026
https://github.com/inbelic updated https://github.com/llvm/llvm-project/pull/212901
>From f4a8734a4192329fb84db330837634ca6563ad55 Mon Sep 17 00:00:00 2001
From: Finn Plummer <mail at inbelic.dev>
Date: Wed, 29 Jul 2026 23:47:58 +0000
Subject: [PATCH] [NFC][HLSL] Fix msan errors in tests
Some of the tests were not initializing all the fields prior to
generating metadata, this caused a read of uninitialized memory and
caused the sanitizer to fail.
Assisted by: Claude Opus 5
---
.../Frontend/HLSLSemanticSignatureMetadataTest.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/llvm/unittests/Frontend/HLSLSemanticSignatureMetadataTest.cpp b/llvm/unittests/Frontend/HLSLSemanticSignatureMetadataTest.cpp
index 6833ee7c60f96..0638cf0f49692 100644
--- a/llvm/unittests/Frontend/HLSLSemanticSignatureMetadataTest.cpp
+++ b/llvm/unittests/Frontend/HLSLSemanticSignatureMetadataTest.cpp
@@ -72,6 +72,10 @@ class HLSLSemanticSignatureMetadataTest : public testing::Test {
TEST_F(HLSLSemanticSignatureMetadataTest, StructHelpers) {
SemanticSignatureElement Elem;
+ Elem.SigId = 0;
+ Elem.CompType = dxil::ElementType::F32;
+ Elem.SemanticKind = dxbc::PSV::SemanticKind::Arbitrary;
+ Elem.Rows = 1;
EXPECT_FALSE(Elem.isAllocated());
Elem.Cols = 4;
@@ -446,9 +450,13 @@ TEST_F(HLSLSemanticSignatureMetadataTest, ElementToMetadataSystemValue) {
// An unallocated element emits the row/col sentinels
TEST_F(HLSLSemanticSignatureMetadataTest, ElementToMetadataUnallocated) {
SemanticSignatureElement Elem;
+ Elem.SigId = 0;
Elem.SemanticName = "POSITION";
Elem.CompType = dxil::ElementType::F32;
+ Elem.SemanticKind = dxbc::PSV::SemanticKind::Arbitrary;
Elem.SemanticIndices = {0};
+ Elem.Rows = 0;
+ Elem.Cols = 0;
MDNode *Node = Elem.toMetadata(Ctx);
ASSERT_EQ(Node->getNumOperands(), 13u);
More information about the llvm-commits
mailing list