[PATCH] D41981: [SROA] fix assetion failure

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 16:20:48 PST 2018


efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM, but don't close PR35657 until you track down the miscompile.  (csmith should not be generating code with out-of-bounds accesses, so there's probably another bug somewhere.)



================
Comment at: lib/Transforms/Scalar/SROA.cpp:3933
   AllocaInst *NewAI;
-  if (SliceTy == AI.getAllocatedType()) {
-    assert(P.beginOffset() == 0 &&
-           "Non-zero begin offset but same alloca type");
+  if (SliceTy == AI.getAllocatedType() && P.beginOffset() == 0) {
     NewAI = &AI;
----------------
Please add a comment explaining that beginOffset() != 0 can happen for out-of-bounds accesses.  (We want to transform anyway because we don't want undefined behavior in unreachable code to block optimizations in other code.)


https://reviews.llvm.org/D41981





More information about the llvm-commits mailing list