Test/DependencyAnalysis: Fix uninitialized variables
diff --git a/test/opt/loop_optimizations/dependence_analysis.cpp b/test/opt/loop_optimizations/dependence_analysis.cpp index a9799ca..3241c89 100644 --- a/test/opt/loop_optimizations/dependence_analysis.cpp +++ b/test/opt/loop_optimizations/dependence_analysis.cpp
@@ -1419,7 +1419,7 @@ std::vector<const ir::Loop*> loops{loop}; opt::LoopDependenceAnalysis analysis{context.get(), loops}; - const ir::Instruction* store; + const ir::Instruction* store = nullptr; for (const ir::Instruction& inst : *spvtest::GetBasicBlock(f, 29)) { if (inst.opcode() == SpvOp::SpvOpStore) { store = &inst; @@ -1440,7 +1440,7 @@ std::vector<const ir::Loop*> loops{loop}; opt::LoopDependenceAnalysis analysis{context.get(), loops}; - const ir::Instruction* store; + const ir::Instruction* store = nullptr; for (const ir::Instruction& inst : *spvtest::GetBasicBlock(f, 54)) { if (inst.opcode() == SpvOp::SpvOpStore) { store = &inst; @@ -1462,7 +1462,7 @@ std::vector<const ir::Loop*> loops{loop}; opt::LoopDependenceAnalysis analysis{context.get(), loops}; - const ir::Instruction* store; + const ir::Instruction* store = nullptr; for (const ir::Instruction& inst : *spvtest::GetBasicBlock(f, 75)) { if (inst.opcode() == SpvOp::SpvOpStore) { store = &inst; @@ -1483,7 +1483,7 @@ std::vector<const ir::Loop*> loops{loop}; opt::LoopDependenceAnalysis analysis{context.get(), loops}; - const ir::Instruction* store; + const ir::Instruction* store = nullptr; for (const ir::Instruction& inst : *spvtest::GetBasicBlock(f, 99)) { if (inst.opcode() == SpvOp::SpvOpStore) { store = &inst; @@ -1505,7 +1505,7 @@ std::vector<const ir::Loop*> loops{loop}; opt::LoopDependenceAnalysis analysis{context.get(), loops}; - const ir::Instruction* store; + const ir::Instruction* store = nullptr; for (const ir::Instruction& inst : *spvtest::GetBasicBlock(f, 121)) { if (inst.opcode() == SpvOp::SpvOpStore) { store = &inst; @@ -1526,7 +1526,7 @@ std::vector<const ir::Loop*> loops{loop}; opt::LoopDependenceAnalysis analysis{context.get(), loops}; - const ir::Instruction* store; + const ir::Instruction* store = nullptr; for (const ir::Instruction& inst : *spvtest::GetBasicBlock(f, 142)) { if (inst.opcode() == SpvOp::SpvOpStore) { store = &inst; @@ -1548,7 +1548,7 @@ std::vector<const ir::Loop*> loops{loop}; opt::LoopDependenceAnalysis analysis{context.get(), loops}; - const ir::Instruction* store; + const ir::Instruction* store = nullptr; for (const ir::Instruction& inst : *spvtest::GetBasicBlock(f, 162)) { if (inst.opcode() == SpvOp::SpvOpStore) { store = &inst; @@ -1569,7 +1569,7 @@ std::vector<const ir::Loop*> loops{loop}; opt::LoopDependenceAnalysis analysis{context.get(), loops}; - const ir::Instruction* store; + const ir::Instruction* store = nullptr; for (const ir::Instruction& inst : *spvtest::GetBasicBlock(f, 183)) { if (inst.opcode() == SpvOp::SpvOpStore) { store = &inst;
diff --git a/test/opt/loop_optimizations/dependence_analysis_helpers.cpp b/test/opt/loop_optimizations/dependence_analysis_helpers.cpp index 37120ee..f4c5e27 100644 --- a/test/opt/loop_optimizations/dependence_analysis_helpers.cpp +++ b/test/opt/loop_optimizations/dependence_analysis_helpers.cpp
@@ -170,7 +170,7 @@ std::vector<const ir::Loop*> loops{loop}; opt::LoopDependenceAnalysis analysis{context.get(), loops}; - const ir::Instruction* store[1]; + const ir::Instruction* store[1] = {nullptr}; int stores_found = 0; for (const ir::Instruction& inst : *spvtest::GetBasicBlock(f, 16)) { if (inst.opcode() == SpvOp::SpvOpStore) { @@ -197,7 +197,7 @@ std::vector<const ir::Loop*> loops{loop}; opt::LoopDependenceAnalysis analysis{context.get(), loops}; - const ir::Instruction* store[1]; + const ir::Instruction* store[1] = {nullptr}; int stores_found = 0; for (const ir::Instruction& inst : *spvtest::GetBasicBlock(f, 47)) { if (inst.opcode() == SpvOp::SpvOpStore) {