[PATCH] D153942: [NFC]Fix possibly derefer nullptr in ComplexDeinterleavingPass.cpp

Wang, Xin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 02:51:34 PDT 2023


XinWang10 added inline comments.


================
Comment at: llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp:1039
     FinalNode = identifyMultiplications(RealMuls, ImagMuls, FinalNode);
-    if (!FinalNode)
-      return nullptr;
----------------
igor.kirillov wrote:
> If there are **Muls** and they are not processed, then there is no point to continue analysing Addends. Therefore it is better to have an early exit here.
> 
> Also **Collect** function, if it returns true, always would fill either **Addends** or **Muls**. That's why there is no way for the control flow to miss either FinalNode check in the original code. So, FinalNode can't be nullptr by that point
Thanks for explanation, make sense here. I want to add assert instead to mute the static analyzer check. Does this look good to you?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153942



More information about the llvm-commits mailing list