[PATCH] D40390: [InstCombine] Don't crash on unreasonable constant indexes

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 09:05:23 PST 2017


spatel added a comment.

I agree that we can't let these cases cause a crash, but this is at least 2 independent patches.

Let's handle the insertelement case first. The LangRef says:
"If idx exceeds the length of val, the results are undefined."
http://llvm.org/docs/LangRef.html#insertelement-instruction

So let's add a fold for that to InstSimplify, and we don't have to deal with it in InstCombine?


https://reviews.llvm.org/D40390





More information about the llvm-commits mailing list