[InstSimplify] Fold out-of-bounds shift to poison
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 3 Jan 2021 20:10:00 +0000 (21:10 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 6 Jan 2021 19:41:37 +0000 (20:41 +0100)
commita6df39236fdc6e422f6794935e5e08e05f566e23
treef607fb530fd03b985290fdea2cd6face8d127a0a
parent8f9da24fa7fffd52ccc2c66e3e2c1e7e87ed0336
[InstSimplify] Fold out-of-bounds shift to poison

Make InstSimplify return poison rather than undef for out-of-bounds
shifts, as specified by LandRef:

> If op2 is (statically or dynamically) equal to or larger than the
> number of bits in op1, this instruction returns a poison value.

Differential Revision: https://reviews.llvm.org/D93998
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll
llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
llvm/test/Transforms/InstCombine/phi-shifts.ll
llvm/test/Transforms/InstCombine/shift.ll
llvm/test/Transforms/InstSimplify/shift-knownbits.ll
llvm/test/Transforms/InstSimplify/shift.ll
llvm/test/Transforms/InstSimplify/undef.ll