[PATCH] D24462: [ARM] Don't convert switches to lookup tables of pointers with ROPI/RWPI

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 17:25:20 PDT 2016


efriedma added inline comments.


> SimplifyCFG.cpp:4441
> +    if (!CE->isGEPWithNoNotionalOverIndexing())
> +      return false;
>  

I think this needs to be something more like:

  if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
    if (!CE->isGEPWithNoNotionalOverIndexing())
      return false;
    if (!ValidLookupTableConstant(CE->getOperand(0)))
      return false;
  }

Specifically, you need to recurse over GEPs to make sure they aren't doing anything that can't be represented in a global variable.  (I guess it's an existing issue, but worth solving while you're here.)

https://reviews.llvm.org/D24462





More information about the llvm-commits mailing list