aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@sifive.com>2022-05-11 11:52:07 -0700
committerCraig Topper <craig.topper@sifive.com>2022-05-11 12:06:45 -0700
commitedbf390d10b86962774c920cfab089fa1fd1c3f5 (patch)
treecac45c3413348a72df9c3a1a94aa2337e647835d /llvm/lib/CodeGen/CodeGenPrepare.cpp
parentca81c0f8fca4730d4cf9c950c2b38d10e37d7357 (diff)
downloadllvm-edbf390d10b86962774c920cfab089fa1fd1c3f5.zip
llvm-edbf390d10b86962774c920cfab089fa1fd1c3f5.tar.gz
llvm-edbf390d10b86962774c920cfab089fa1fd1c3f5.tar.bz2
[CodeGenPrepare] Use const reference to avoid unnecessary APInt copy. NFC
Spotted while looking at Matthias' patches. Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D124985
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 813fbd1..c91dfd2 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -7021,7 +7021,7 @@ bool CodeGenPrepare::optimizeSwitchType(SwitchInst *SI) {
ExtInst->setDebugLoc(SI->getDebugLoc());
SI->setCondition(ExtInst);
for (auto Case : SI->cases()) {
- APInt NarrowConst = Case.getCaseValue()->getValue();
+ const APInt &NarrowConst = Case.getCaseValue()->getValue();
APInt WideConst = (ExtType == Instruction::ZExt) ?
NarrowConst.zext(RegWidth) : NarrowConst.sext(RegWidth);
Case.setValue(ConstantInt::get(Context, WideConst));