[PATCH] D113164: [NFC] Avoid nullptr dereference

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 22:47:33 PDT 2021


pengfei added inline comments.


================
Comment at: llvm/lib/CodeGen/TypePromotion.cpp:259-260
     return LessOrEqualTypeSize(Store->getValueOperand());
   if (auto *Return = dyn_cast<ReturnInst>(V))
-    return LessOrEqualTypeSize(Return->getReturnValue());
   if (auto *ZExt = dyn_cast<ZExtInst>(V))
----------------
skan wrote:
> You mean
> 
> `Return->getReturnValue()` may return a NULL pointer but `LessOrEqualTypeSize` assumes its argument is never be a NULL?
> 
> If the answer is yes, you need to provide a test case tiggering the compfail. 
Agreed with @skan . You changed the functionality here.
Besides, I didn't find difference between `StoreInst` and `ReturnInst`, why only warn here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113164



More information about the llvm-commits mailing list