summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/shift.ll
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-01-03 18:28:20 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-01-03 18:28:20 +0000
commit3bf2d645890f91398e1a28586188fad3c831933a (patch)
treeac1ea9dc1b2a1bb22cde39ac6d82b40d99f529f1 /llvm/test/Transforms/InstCombine/shift.ll
parent8232e88dd56a94b5d883479d2d6ae96c11b8d6f1 (diff)
downloadbcm5719-llvm-3bf2d645890f91398e1a28586188fad3c831933a.tar.gz
bcm5719-llvm-3bf2d645890f91398e1a28586188fad3c831933a.zip
[InstCombine] Check for out of range shift values using APInt before calling getZExtValue
Reduced from oss-fuzz #4871 test case llvm-svn: 321748
Diffstat (limited to 'llvm/test/Transforms/InstCombine/shift.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/shift.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift.ll b/llvm/test/Transforms/InstCombine/shift.ll
index ba52023e0db..38fd5462611 100644
--- a/llvm/test/Transforms/InstCombine/shift.ll
+++ b/llvm/test/Transforms/InstCombine/shift.ll
@@ -1592,3 +1592,24 @@ define i32 @ashr_select_xor_false(i32 %x, i1 %cond) {
%3 = ashr i32 %2, 1
ret i32 %3
}
+
+; OSS Fuzz #4871
+; https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4871
+define i177 @lshr_out_of_range(i177 %Y, i177** %A2) {
+; CHECK-LABEL: @lshr_out_of_range(
+; CHECK-NEXT: store i177** [[A2:%.*]], i177*** undef, align 8
+; CHECK-NEXT: ret i177 0
+;
+ %B5 = udiv i177 %Y, -1
+ %B4 = add i177 %B5, -1
+ %B2 = add i177 %B4, -1
+ %B6 = mul i177 %B5, %B2
+ %B3 = add i177 %B2, %B2
+ %B10 = sub i177 %B5, %B3
+ %B12 = lshr i177 %Y, %B6
+ %C8 = icmp ugt i177 %B12, %B4
+ %G18 = getelementptr i177*, i177** %A2, i1 %C8
+ store i177** %G18, i177*** undef
+ %B1 = udiv i177 %B10, %B6
+ ret i177 %B1
+}
OpenPOWER on IntegriCloud