Skip to content

Commit b18ca21

Browse files
Reapply "[X86] Remove Redundant memset Calls"
This reverts commit acb798e. It turns out the memset calls were papering over the fact that the arrays being used were not initialized rather than papering over a valgrind issue. Move the initialization to the actual member to keep things simpler and to be more consistent with the rest of LLVM.
1 parent cfa590e commit b18ca21

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

llvm/lib/Target/X86/X86FloatingPoint.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,7 @@ namespace {
5858

5959
struct FPS : public MachineFunctionPass {
6060
static char ID;
61-
FPS() : MachineFunctionPass(ID) {
62-
// This is really only to keep valgrind quiet.
63-
// The logic in isLive() is too much for it.
64-
memset(Stack, 0, sizeof(Stack));
65-
memset(RegMap, 0, sizeof(RegMap));
66-
}
61+
FPS() : MachineFunctionPass(ID) {}
6762

6863
void getAnalysisUsage(AnalysisUsage &AU) const override {
6964
AU.setPreservesCFG();
@@ -148,7 +143,7 @@ namespace {
148143
// to model that exactly. Usually, each live register corresponds to an
149144
// FP<n> register, but when dealing with calls, returns, and inline
150145
// assembly, it is sometimes necessary to have live scratch registers.
151-
unsigned Stack[8]; // FP<n> Registers in each stack slot...
146+
unsigned Stack[8] = {}; // FP<n> Registers in each stack slot...
152147
unsigned StackTop = 0; // The current top of the FP stack.
153148

154149
enum {
@@ -159,7 +154,7 @@ namespace {
159154
// The first entries correspond to FP0-FP6, the rest are scratch registers
160155
// used when we need slightly different live registers than what the
161156
// register allocator thinks.
162-
unsigned RegMap[NumFPRegs];
157+
unsigned RegMap[NumFPRegs] = {};
163158

164159
// Set up our stack model to match the incoming registers to MBB.
165160
void setupBlockStack();

0 commit comments

Comments
 (0)