[llvm] 5857e09 - [NFC][HLSL] Fix msan errors in tests (#212901)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 29 18:05:58 PDT 2026
Author: Finn Plummer
Date: 2026-07-29T18:05:52-07:00
New Revision: 5857e09ae75d08c93de717f5a2e1c0e2c1ddd06f
URL: https://github.com/llvm/llvm-project/commit/5857e09ae75d08c93de717f5a2e1c0e2c1ddd06f
DIFF: https://github.com/llvm/llvm-project/commit/5857e09ae75d08c93de717f5a2e1c0e2c1ddd06f.diff
LOG: [NFC][HLSL] Fix msan errors in tests (#212901)
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
Caught here: https://lab.llvm.org/buildbot/#/builders/94/builds/19767
Added:
Modified:
llvm/unittests/Frontend/HLSLSemanticSignatureMetadataTest.cpp
Removed:
################################################################################
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