[PATCH] D124985: [CodeGenPrepare] Use const reference to avoid unnecessary APInt copy. NFC
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 4 23:21:35 PDT 2022
craig.topper created this revision.
craig.topper added reviewers: MatzeB, RKSimon, spatel.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.
Spotted while looking at Matthias' patches.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124985
Files:
llvm/lib/CodeGen/CodeGenPrepare.cpp
Index: llvm/lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -7019,7 +7019,7 @@
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));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124985.427206.patch
Type: text/x-patch
Size: 639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220505/efba709f/attachment-0001.bin>
More information about the llvm-commits
mailing list