Skip to content

Commit 2fb53df

Browse files
fda0igcbot
authored andcommitted
Use const ref. Initialize members.
In RematChainsAnalysis.hpp pass arguments using const reference to avoid copy construction. Initialize pointer members to nullptr to avoid uninitialized memory usage.
1 parent a29088c commit 2fb53df

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

IGC/Compiler/CISACodeGen/RematChainsAnalysis.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ typedef llvm::SmallSet<llvm::Instruction *, 8> RematChainSet;
2525

2626
class RematChainPattern {
2727
public:
28-
RematChainPattern(RematChainSet RematChain, llvm::Instruction *LastInst, llvm::Instruction *RematChainUser)
28+
RematChainPattern(const RematChainSet& RematChain, llvm::Instruction *LastInst, llvm::Instruction *RematChainUser)
2929
: RematChain(RematChain), LastInstruction(LastInst), RematChainUser(RematChainUser) {
3030
IGC_ASSERT(!RematChain.empty() && "Remat chain cannot be empty");
3131
IGC_ASSERT(RematChainUser && "Remat chain user cannot be null");
@@ -61,9 +61,9 @@ class RematChainPattern {
6161

6262
private:
6363
RematChainSet RematChain;
64-
llvm::Instruction *LastInstruction;
65-
llvm::Instruction *FirstInstruction;
66-
llvm::Instruction *RematChainUser;
64+
llvm::Instruction *LastInstruction = nullptr;
65+
llvm::Instruction *FirstInstruction = nullptr;
66+
llvm::Instruction *RematChainUser = nullptr;
6767
};
6868

6969
class RematChainsAnalysis : public llvm::FunctionPass {

0 commit comments

Comments
 (0)