[PATCH] D49816: [GlobalOpt] Test array indices inside structs for out-of-bounds accesses

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 25 12:21:16 PDT 2018


efriedma added inline comments.


================
Comment at: lib/Transforms/IPO/GlobalOpt.cpp:382
   if (GEPI->getNumOperands() < 3 || !isa<Constant>(GEPI->getOperand(1)) ||
       !cast<Constant>(GEPI->getOperand(1))->isNullValue())
     return false;
----------------
Do we need to do the same GEP validation here?


================
Comment at: lib/Transforms/IPO/GlobalOpt.cpp:414
+  // bit more checking for sanity.
+  if (GEPI.isSequential() || GEPI.isStruct()) {
     ConstantInt *Idx = cast<ConstantInt>(U->getOperand(2));
----------------
"GEPI.isSequential() || GEPI.isStruct()" is always true.


https://reviews.llvm.org/D49816





More information about the llvm-commits mailing list