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

Oliver Stannard via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 09:36:17 PDT 2016


olista01 added inline comments.


> efriedma wrote in SimplifyCFG.cpp:4441
> 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.)

Good catch, I'll put up a separate patch for that once I can find a good test for it.

https://reviews.llvm.org/D24462





More information about the llvm-commits mailing list