[llvm] 7271681 - [CFIFixup] Add a default constructor to BlockFlags (NFC) (#125296)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 31 23:31:34 PST 2025
Author: Kazu Hirata
Date: 2025-01-31T23:31:31-08:00
New Revision: 7271681286ec0eb8e1b0dc9982b3914701715d7f
URL: https://github.com/llvm/llvm-project/commit/7271681286ec0eb8e1b0dc9982b3914701715d7f
DIFF: https://github.com/llvm/llvm-project/commit/7271681286ec0eb8e1b0dc9982b3914701715d7f.diff
LOG: [CFIFixup] Add a default constructor to BlockFlags (NFC) (#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 replace
the explicit default constructor with:
bool Reachable : 1 = true;
:
Added:
Modified:
llvm/lib/CodeGen/CFIFixup.cpp
Removed:
################################################################################
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