[llvm] [Metadata] Use const APInt &. NFC (PR #101865)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 3 22:36:38 PDT 2024
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/101865
getValue returns a const APInt &. So using a const APInt & will avoid a copy.
>From 99ce01979ac2af4e706d1916bc061d1b21e9097c Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Sat, 3 Aug 2024 22:34:25 -0700
Subject: [PATCH] [Metadata] Use const APInt &. NFC
getValue returns a const APInt &. So using a const APInt & will avoid a
copy.
---
llvm/lib/IR/Metadata.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index ae5f5de142328..51442b94a6246 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -1250,8 +1250,8 @@ static bool tryMergeRange(SmallVectorImpl<ConstantInt *> &EndPoints,
ConstantInt *Low, ConstantInt *High) {
ConstantRange NewRange(Low->getValue(), High->getValue());
unsigned Size = EndPoints.size();
- APInt LB = EndPoints[Size - 2]->getValue();
- APInt LE = EndPoints[Size - 1]->getValue();
+ const APInt &LB = EndPoints[Size - 2]->getValue();
+ const APInt &LE = EndPoints[Size - 1]->getValue();
ConstantRange LastRange(LB, LE);
if (canBeMerged(NewRange, LastRange)) {
ConstantRange Union = LastRange.unionWith(NewRange);
More information about the llvm-commits
mailing list