From 1e659e373d46a588938b80db4efc5c9c05067b11 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 1 Dec 2021 09:07:36 -0800 Subject: [NFC] Avoid some unnecessary copies of PassOptions (#4361) PassOptions is a fairly large structure and even includes a std::map. I also have plans to add further fields there to make it even larger. Before doing that I noticed that in some places we copy it instead of being consistent and taking it by reference, which this PR fixes. --- src/passes/LocalCSE.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/passes/LocalCSE.cpp') diff --git a/src/passes/LocalCSE.cpp b/src/passes/LocalCSE.cpp index f487986a3..4728f189a 100644 --- a/src/passes/LocalCSE.cpp +++ b/src/passes/LocalCSE.cpp @@ -204,12 +204,12 @@ struct RequestInfoMap : public std::unordered_map { struct Scanner : public LinearExecutionWalker> { - PassOptions options; + PassOptions& options; // Request info for all expressions ever seen. RequestInfoMap& requestInfos; - Scanner(PassOptions options, RequestInfoMap& requestInfos) + Scanner(PassOptions& options, RequestInfoMap& requestInfos) : options(options), requestInfos(requestInfos) {} // Currently active hashed expressions in the current basic block. If we see @@ -351,10 +351,10 @@ struct Scanner // make Applier ignore them. struct Checker : public LinearExecutionWalker> { - PassOptions options; + PassOptions& options; RequestInfoMap& requestInfos; - Checker(PassOptions options, RequestInfoMap& requestInfos) + Checker(PassOptions& options, RequestInfoMap& requestInfos) : options(options), requestInfos(requestInfos) {} struct ActiveOriginalInfo { @@ -529,7 +529,7 @@ struct LocalCSE : public WalkerPass> { Pass* create() override { return new LocalCSE(); } void doWalkFunction(Function* func) { - auto options = getPassOptions(); + auto& options = getPassOptions(); RequestInfoMap requestInfos; -- cgit v1.2.3