[llvm] [Hexagon] Fix -Wuninitialized warning (PR #125565)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 3 11:54:31 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-hexagon
Author: Brian Cain (androm3da)
<details>
<summary>Changes</summary>
`gcc (GCC) 14.2.1 20240910` reports the warning below on the baseline, this change fixes the warning.
In file included from /home/user/CLionProjects/llvm-project/llvm/lib/Target/Hexagon/BitTracker.cpp:55:
/home/user/CLionProjects/llvm-project/llvm/lib/Target/Hexagon/BitTracker.h: In constructor ‘llvm::BitTracker::UseQueueType::UseQueueType()’:
/home/user/CLionProjects/llvm-project/llvm/lib/Target/Hexagon/BitTracker.h:75:27: warning: member ‘llvm::BitTracker::UseQueueType::Dist’ is used uninitialized [-Wuninitialized]
75 | UseQueueType() : Uses(Dist) {}
| ^~~~
Fixes #<!-- -->125545
---
Full diff: https://github.com/llvm/llvm-project/pull/125565.diff
1 Files Affected:
- (modified) llvm/lib/Target/Hexagon/BitTracker.h (+2-2)
``````````diff
diff --git a/llvm/lib/Target/Hexagon/BitTracker.h b/llvm/lib/Target/Hexagon/BitTracker.h
index 08c0359a4b7f06..a07abdb7303321 100644
--- a/llvm/lib/Target/Hexagon/BitTracker.h
+++ b/llvm/lib/Target/Hexagon/BitTracker.h
@@ -72,7 +72,7 @@ struct BitTracker {
// Priority queue of instructions using modified registers, ordered by
// their relative position in a basic block.
struct UseQueueType {
- UseQueueType() : Uses(Dist) {}
+ UseQueueType() : Dist(), Uses(Dist) {}
unsigned size() const {
return Uses.size();
@@ -100,9 +100,9 @@ struct BitTracker {
bool operator()(const MachineInstr *MI, const MachineInstr *MJ) const;
DenseMap<const MachineInstr*,unsigned> &Dist;
};
- std::priority_queue<MachineInstr*, std::vector<MachineInstr*>, Cmp> Uses;
DenseSet<const MachineInstr*> Set; // Set to avoid adding duplicate entries.
DenseMap<const MachineInstr*,unsigned> Dist;
+ std::priority_queue<MachineInstr *, std::vector<MachineInstr *>, Cmp> Uses;
};
void reset();
``````````
</details>
https://github.com/llvm/llvm-project/pull/125565
More information about the llvm-commits
mailing list