[PATCH] D148692: Fix uninitialized class members

Akshay Khadse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 08:43:00 PDT 2023


akshaykhadse added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/ReachingDefAnalysis.h:90
   /// The first instruction in each basic block is 0.
-  int CurInstr;
+  int CurInstr = -1;
 
----------------
LuoYuanke wrote:
> It seems in `ReachingDefAnalysis::enterBasicBlock()` `CurInstr` is reset to 0, so I wonder if it is better to initialized to 0.
Setting it to 0 would imply that there is at least one instruction in the basic block. I am not sure if that would be true if this method would run on empty basic block. But, if we cna be sure that there are no empty basic blocks, we can set it to 0. Let me know what you think.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148692/new/

https://reviews.llvm.org/D148692



More information about the llvm-commits mailing list