[PATCH] D102711: [GlobalOpt] Handle null check with global pointer variables

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 18 15:14:47 PDT 2021


efriedma added a comment.

New testcases look good.



================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:979
       case ICmpInst::ICMP_ULT:
       case ICmpInst::ICMP_SLT:   // X < null -> always false
         LV = ConstantInt::getFalse(GV->getContext());
----------------
Can we explicitly note here, for the signed compares, why it doesn't matter if the high bit of the global is set? The logic here isn't obvious.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:988
       case ICmpInst::ICMP_NE:
       case ICmpInst::ICMP_UGE:
       case ICmpInst::ICMP_SGE:
----------------
UGE should fold to `ConstantInt::getTrue(GV->getContext());`


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

https://reviews.llvm.org/D102711



More information about the llvm-commits mailing list