[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:16:11 PST 2017


spatel added inline comments.


================
Comment at: test/Transforms/InstCombine/out-of-bounds-indexes.ll:1
 ; RUN: opt < %s -instcombine -disable-output
 ; Check that we don't crash on unreasonable constant indexes in various operations
----------------
I know we're just making sure that we don't crash here, but I prefer to still run FileCheck and add check lines using /utils/update_test_checks.py, so we know what's actually coming out of instcombine.

Also, we can shrink both of these tests a bit to just focus on the bad instructions:

```
define i32 @lshr_bad_shift_amount(i32 %a) {
  %B = lshr i32 %a, 33
  %cmp = icmp eq i32 %B, 1
  tail call void @llvm.assume(i1 %cmp)
  ret i32 %B
}

define <4 x double> @inselt_bad_index(<4 x double> %a) {
  %I = insertelement <4 x double> %a, double 0.0, i64 4294967296
  ret <4 x double> %I
}

```


https://reviews.llvm.org/D40390





More information about the llvm-commits mailing list