Skip to content

Commit

Permalink
Prevent unnecessary copies.
Browse files Browse the repository at this point in the history
  • Loading branch information
maarquitos14 committed Nov 13, 2024
1 parent 15fd1cc commit b5c40b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/SPIRV/SPIRVReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3220,7 +3220,7 @@ Function *SPIRVToLLVM::transFunction(SPIRVFunction *BF, unsigned AS) {
// search for a previous function with the same name
// upgrade it to a kernel and drop this if it's found
for (auto &I : FuncMap) {
auto BFName = I.getFirst()->getName();
const auto &BFName = I.getFirst()->getName();
if (BF->getName() == BFName) {
auto *F = I.getSecond();
F->setCallingConv(CallingConv::SPIR_KERNEL);
Expand Down
11 changes: 6 additions & 5 deletions lib/SPIRV/SPIRVWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,8 @@ SPIRVValue *LLVMToSPIRVBase::transConstantUse(Constant *C,
Ops = getVec(PtrTy->getId(), Ops);
}
}
return BM->addPtrAccessChainInst(ExpectedType, Ops, nullptr, true);
return BM->addPtrAccessChainInst(ExpectedType, std::move(Ops), nullptr,
true);
}
}

Expand Down Expand Up @@ -1470,7 +1471,7 @@ SPIRVValue *LLVMToSPIRVBase::transConstant(Value *V) {
Ops = getVec(PtrTy->getId(), Ops);
}
}
return BM->addPtrAccessChainInst(TranslatedTy, Ops, nullptr,
return BM->addPtrAccessChainInst(TranslatedTy, std::move(Ops), nullptr,
GEP->isInBounds());
}
auto *Inst = ConstUE->getAsInstruction();
Expand Down Expand Up @@ -2569,8 +2570,8 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
// access chain instructions. Replace return type to do that.
TranslatedTy = SPVPointerOperand->getType();

return mapValue(
V, BM->addPtrAccessChainInst(TranslatedTy, Ops, BB, GEP->isInBounds()));
return mapValue(V, BM->addPtrAccessChainInst(TranslatedTy, std::move(Ops),
BB, GEP->isInBounds()));
}

if (auto *Ext = dyn_cast<ExtractElementInst>(V)) {
Expand Down Expand Up @@ -4320,7 +4321,7 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
Zero = BM->addConstant(ResTy, 0);
APInt MinusOneValue(ResTy->getIntegerBitWidth(), 0, 1);
MinusOneValue.setAllBits();
MinusOne = BM->addConstant(ResTy, MinusOneValue);
MinusOne = BM->addConstant(ResTy, std::move(MinusOneValue));
}

Op OC1 = (IID == Intrinsic::scmp) ? OpSLessThanEqual : OpULessThanEqual;
Expand Down

0 comments on commit b5c40b0

Please sign in to comment.