[PATCH] D40390: [InstCombine] Don't crash on out of bounds index in the insertelement

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 08:32:17 PST 2017


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineVectorOps.cpp:790
   // Inserting an undef or into an undefined place, remove this.
   if (isa<UndefValue>(ScalarOp) || isa<UndefValue>(IdxOp))
     replaceInstUsesWith(IE, VecOp);
----------------
Maybe off-topic for this patch thread, but since we're cleaning this all up (thanks!), we should fix this line as mentioned in D40231 / D40650. If the index is undef, then we can return undef rather than VecOp (and it should happen in InstSimplify, not here).


https://reviews.llvm.org/D40390





More information about the llvm-commits mailing list