Tweak minor const-ref/std::move things in script-opt code

This commit is contained in:
Jon Siwek 2021-03-08 15:50:04 -08:00
parent 4b6369a333
commit b66f4ad500
4 changed files with 9 additions and 9 deletions

View file

@ -90,7 +90,7 @@ bool Reducer::ID_IsReduced(const ID* id) const
IsNewLocal(id);
}
NameExprPtr Reducer::GenInlineBlockName(IDPtr id)
NameExprPtr Reducer::GenInlineBlockName(const IDPtr& id)
{
return make_intrusive<NameExpr>(GenLocal(id));
}
@ -1004,7 +1004,7 @@ bool CSE_ValidityChecker::CheckID(const std::vector<const ID*>& ids,
bool CSE_ValidityChecker::CheckAggrMod(const std::vector<const ID*>& ids,
const Expr* e) const
{
auto e_i_t = e->GetType();
const auto& e_i_t = e->GetType();
if ( IsAggr(e_i_t) )
{
// This assignment sets an aggregate value.

View file

@ -20,8 +20,8 @@ public:
StmtPtr Reduce(StmtPtr s)
{
reduction_root = s;
return s->Reduce(this);
reduction_root = std::move(s);
return reduction_root->Reduce(this);
}
const DefSetsMgr* GetDefSetsMgr() const { return mgr; }
@ -45,7 +45,7 @@ public:
// This is called *prior* to pushing a new inline block, in
// order to generate the equivalent of function parameters.
NameExprPtr GenInlineBlockName(IDPtr id);
NameExprPtr GenInlineBlockName(const IDPtr& id);
int NumNewLocals() const { return new_locals.size(); }
@ -141,7 +141,7 @@ public:
// one (meant for calls in an Expr context) does not, to avoid
// circularity.
ExprPtr OptExpr(Expr* e);
ExprPtr OptExpr(ExprPtr e)
ExprPtr OptExpr(const ExprPtr& e)
{ return OptExpr(e.get()); }
// This one for expressions appearing in an Expr context.

View file

@ -11,7 +11,7 @@ TempVar::TempVar(int num, const TypePtr& t, ExprPtr _rhs) : type(t)
char buf[8192];
snprintf(buf, sizeof buf, "#%d", num);
name = buf;
rhs = _rhs;
rhs = std::move(_rhs);
}
void TempVar::SetAlias(IDPtr _alias, const DefPoints* _dps)
@ -28,7 +28,7 @@ void TempVar::SetAlias(IDPtr _alias, const DefPoints* _dps)
if ( alias == id )
reporter->InternalError("Creating alias loop");
alias = _alias;
alias = std::move(_alias);
dps = _dps;
}

View file

@ -39,7 +39,7 @@ public:
void SetDPs(const DefPoints* _dps);
const RDPtr& MaxRDs() const { return max_rds; }
void SetMaxRDs(RDPtr rds) { max_rds = rds; }
void SetMaxRDs(RDPtr rds) { max_rds = std::move(rds); }
protected:
std::string name;