Subzero: Fix warning ‘Ty’ may be used uninitialized
Bug: b/130343040
Change-Id: I4e69330929ddc81f840c01fe9ceb8a06d5869f53
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29049
Presubmit-Ready: Ben Clayton <bclayton@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/third_party/llvm-subzero/lib/Support/Host.cpp b/third_party/llvm-subzero/lib/Support/Host.cpp
index dd19eee..52fc297 100644
--- a/third_party/llvm-subzero/lib/Support/Host.cpp
+++ b/third_party/llvm-subzero/lib/Support/Host.cpp
@@ -740,7 +740,7 @@
static unsigned getAvailableFeatures(unsigned int ECX, unsigned int EDX,
unsigned MaxLeaf) {
unsigned Features = 0;
- unsigned int EAX, EBX;
+ unsigned int EAX = 0, EBX = 0;
Features |= (((EDX >> 23) & 1) << FEATURE_MMX);
Features |= (((EDX >> 25) & 1) << FEATURE_SSE);
Features |= (((EDX >> 26) & 1) << FEATURE_SSE2);
@@ -796,8 +796,8 @@
detectX86FamilyModel(EAX, &Family, &Model);
Features = getAvailableFeatures(ECX, EDX, MaxLeaf);
- unsigned Type;
- unsigned Subtype;
+ unsigned Type = 0;
+ unsigned Subtype = 0;
if (Vendor == SIG_INTEL) {
getIntelProcessorTypeAndSubtype(Family, Model, Brand_id, Features, &Type,
diff --git a/third_party/subzero/src/IceTargetLoweringX86BaseImpl.h b/third_party/subzero/src/IceTargetLoweringX86BaseImpl.h
index dbc0ee2..250ae56 100644
--- a/third_party/subzero/src/IceTargetLoweringX86BaseImpl.h
+++ b/third_party/subzero/src/IceTargetLoweringX86BaseImpl.h
@@ -5300,7 +5300,7 @@
// reverse order. Then handle any remainder with overlapping copies. Since
// the remainder will be at the end, there will be reduces pressure on the
// memory unit as the access to the same memory are far apart.
- Type Ty;
+ Type Ty = IceType_void;
if (ValValue == 0 && CountValue >= BytesPerStoreq &&
CountValue <= BytesPerStorep * Traits::MEMSET_UNROLL_LIMIT) {
// When the value is zero it can be loaded into a vector register cheaply