[PATCH] D144746: [LLVMContextImpl] Separate out integer constant ones
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 27 10:19:09 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG86bdcdf00e82: [LLVMContextImpl] Separate out integer constant ones (authored by aeubanks).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144746/new/
https://reviews.llvm.org/D144746
Files:
llvm/lib/IR/Constants.cpp
llvm/lib/IR/LLVMContextImpl.cpp
llvm/lib/IR/LLVMContextImpl.h
Index: llvm/lib/IR/LLVMContextImpl.h
===================================================================
--- llvm/lib/IR/LLVMContextImpl.h
+++ llvm/lib/IR/LLVMContextImpl.h
@@ -1447,6 +1447,7 @@
DenseMap<const Value *, ValueName *> ValueNames;
DenseMap<unsigned, std::unique_ptr<ConstantInt>> IntZeroConstants;
+ DenseMap<unsigned, std::unique_ptr<ConstantInt>> IntOneConstants;
DenseMap<APInt, std::unique_ptr<ConstantInt>, DenseMapAPIntKeyInfo>
IntConstants;
Index: llvm/lib/IR/LLVMContextImpl.cpp
===================================================================
--- llvm/lib/IR/LLVMContextImpl.cpp
+++ llvm/lib/IR/LLVMContextImpl.cpp
@@ -117,6 +117,7 @@
UVConstants.clear();
PVConstants.clear();
IntZeroConstants.clear();
+ IntOneConstants.clear();
IntConstants.clear();
FPConstants.clear();
CDSConstants.clear();
Index: llvm/lib/IR/Constants.cpp
===================================================================
--- llvm/lib/IR/Constants.cpp
+++ llvm/lib/IR/Constants.cpp
@@ -875,8 +875,9 @@
// get an existing value or the insertion position
LLVMContextImpl *pImpl = Context.pImpl;
std::unique_ptr<ConstantInt> &Slot =
- V.isZero() ? pImpl->IntZeroConstants[V.getBitWidth()]
- : pImpl->IntConstants[V];
+ V.isZero() ? pImpl->IntZeroConstants[V.getBitWidth()]
+ : V.isOne() ? pImpl->IntOneConstants[V.getBitWidth()]
+ : pImpl->IntConstants[V];
if (!Slot) {
// Get the corresponding integer type for the bit width of the value.
IntegerType *ITy = IntegerType::get(Context, V.getBitWidth());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144746.500836.patch
Type: text/x-patch
Size: 1610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230227/5ac1866a/attachment.bin>
More information about the llvm-commits
mailing list