Currently 'TypeSize' exposes two functions that serve the same purpose:
- getFixedSize / getFixedValue
- getKnownMinSize / getKnownMinValue
This patch offers to remove one of the two and stick to a single function in the code base.
Paths
| Differential D141134
[NFC] Only expose getXXXSize functions in TypeSize ClosedPublic Authored by gchatelet on Jan 6 2023, 6:50 AM.
Details Summary Currently 'TypeSize' exposes two functions that serve the same purpose:
This patch offers to remove one of the two and stick to a single function in the code base.
Diff Detail
Event Timeline
sdesmalen added inline comments.
This revision is now accepted and ready to land.Jan 6 2023, 7:12 AM gchatelet marked an inline comment as done. Comment Actions
Comment Actions I think we should keep a single one, but just to bikeshed, a TypeSize has a Value, not a Size, so I would keep getFixedValue.
This revision was landed with ongoing or failed builds.Jan 6 2023, 7:25 AM Closed by commit rGdd56e1c92b0e: [NFC] Only expose getXXXSize functions in TypeSize (authored by gchatelet). · Explain Why This revision was automatically updated to reflect the committed changes. gchatelet added a reverting change: rG87b6b347fc91: Revert D141134 "[NFC] Only expose getXXXSize functions in TypeSize".Jan 6 2023, 7:30 AM Comment Actions I've reverted the patch so we can discuss further whether we want to keep the Size version of the Value version. This revision is now accepted and ready to land.Jan 6 2023, 7:30 AM Comment Actions This caused a build failure in clang: lib/CodeGen/CGDecl.cpp:1344:46: error: 'getFixedValue' is a private member of 'llvm::TypeSize' Comment Actions
Yep just noticed as well, thx for the heads up @foad. Comment Actions sdesmalen@ do you feel strongly about the getXXXSize version of the functions? Comment Actions
I agree that having one interface for the same thing is better than two, so dropping the getXXXSize() interfaces in favour of getXXXValue() makes sense to me. Thanks for checking! Comment Actions I've created https://reviews.llvm.org/D141267 to get a feel of what it looks like to only keep the Size version. Comment Actions So i've submitted the following patches which remove the usage of TypeSize::getFixedSize() and TypeSize::getKnownMinSize()
I've also marked the functions deprecated so downstream users can fix their codebase.
I'm marking this patch as closed.
Revision Contents
Diff 487333 llvm/include/llvm/Support/TypeSize.h
llvm/lib/Analysis/ConstantFolding.cpp
llvm/lib/Analysis/Loads.cpp
llvm/lib/CodeGen/Analysis.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/StackProtector.cpp
llvm/lib/IR/DataLayout.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.h
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
|
They're both only used once below, so I think you can remove the private interface and just call the parent class' method directly?