[llvm] [CFIFixup] Add a default constructor to BlockFlags (NFC) (PR #125296)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 31 13:19:42 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/125296
This patch adds a default constructor to BlockFlags to initialize its
members to false, placing initializers close to the member
declarations.
Note that once C++20 is available in our codebase, we can eliminate
the explicit default constructor with:
bool Reachable : 1 = true;
:
>From 7aabc23589164d486a7800f537c2ba6439ee262c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 31 Jan 2025 11:57:14 -0800
Subject: [PATCH] [CFIFixup] Add a default constructor to BlockFlags (NFC)
This patch adds a default constructor to BlockFlags to initialize its
members to false, placing initializers close to the member
declarations.
Note that once C++20 is available in our codebase, we can eliminate
the explicit default constructor with:
bool Reachable : 1 = true;
:
---
llvm/lib/CodeGen/CFIFixup.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/CFIFixup.cpp b/llvm/lib/CodeGen/CFIFixup.cpp
index 7778aa637ff08d..7986f7d2134542 100644
--- a/llvm/lib/CodeGen/CFIFixup.cpp
+++ b/llvm/lib/CodeGen/CFIFixup.cpp
@@ -131,6 +131,9 @@ struct BlockFlags {
bool StrongNoFrameOnEntry : 1;
bool HasFrameOnEntry : 1;
bool HasFrameOnExit : 1;
+ BlockFlags()
+ : Reachable(false), StrongNoFrameOnEntry(false), HasFrameOnEntry(false),
+ HasFrameOnExit(false) {}
};
// Most functions will have <= 32 basic blocks.
@@ -141,7 +144,7 @@ using BlockFlagsVector = SmallVector<BlockFlags, 32>;
static BlockFlagsVector
computeBlockInfo(const MachineFunction &MF,
const MachineBasicBlock *PrologueBlock) {
- BlockFlagsVector BlockInfo(MF.getNumBlockIDs(), {false, false, false, false});
+ BlockFlagsVector BlockInfo(MF.getNumBlockIDs());
BlockInfo[0].Reachable = true;
BlockInfo[0].StrongNoFrameOnEntry = true;
More information about the llvm-commits
mailing list