diff options
author | Arthur Eubanks <aeubanks@google.com> | 2023-02-23 21:47:03 -0800 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2023-02-27 10:18:39 -0800 |
commit | 86bdcdf00e82865ee7ae3fcbf843a47235851817 (patch) | |
tree | d139cf8b006d6dcfeae91ca2fed51e8e6ac8b1ac /llvm/lib/IR/Constants.cpp | |
parent | c31667539bc6bf6c7d56c88f216291b1d9a203b9 (diff) | |
download | llvm-86bdcdf00e82865ee7ae3fcbf843a47235851817.zip llvm-86bdcdf00e82865ee7ae3fcbf843a47235851817.tar.gz llvm-86bdcdf00e82865ee7ae3fcbf843a47235851817.tar.bz2 |
[LLVMContextImpl] Separate out integer constant ones
Very small compile time improvement:
https://llvm-compile-time-tracker.com/compare.php?from=6a7a8907e8334eaf551742148079c628f78e6ed7&to=454d1181fbdb9121f0c7a3ecf526520db32ab420&stat=instructions:u
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D144746
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 6efc66d..6e25e22 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -875,8 +875,9 @@ ConstantInt *ConstantInt::get(LLVMContext &Context, const APInt &V) { // 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()); |