diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-07-02 12:54:48 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-07-02 12:54:48 +0000 |
commit | 0bde7c65275ef4fcd51bc92e1b6c280f9888b73f (patch) | |
tree | 21469a76b6790a2005c10cbe63f6036e6ed424e1 /llvm/test/Transforms | |
parent | 6c0dcf65e7105611d4fe46e2a10629ce3c9abe5c (diff) | |
download | bcm5719-llvm-0bde7c65275ef4fcd51bc92e1b6c280f9888b73f.tar.gz bcm5719-llvm-0bde7c65275ef4fcd51bc92e1b6c280f9888b73f.zip |
[InstCombine] Shift amount reassociation: fixup constantexpr handling (PR42484)
I was actually wondering if there was some nicer way than m_Value()+cast,
but apparently what i was really "subconsciously" thinking about
was correctness issue.
hasNoUnsignedWrap()/hasNoUnsignedWrap() exist for Instruction,
not for BinaryOperator, so let's just use m_Instruction(),
thus both avoiding a cast, and a crash.
Fixes https://bugs.llvm.org/show_bug.cgi?id=42484,
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15587
llvm-svn: 364915
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll b/llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll index f7cd0791482..e124a035861 100644 --- a/llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll +++ b/llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll @@ -154,6 +154,21 @@ define i32 @t11_shl_nsw_flag_preservation(i32 %x, i32 %y) { ret i32 %t3 } +; Reduced from https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15587 +@X = external global i32 +define i64 @constantexpr() { +; CHECK-LABEL: @constantexpr( +; CHECK-NEXT: ret i64 0 +; + %A = alloca i64 + %L = load i64, i64* %A + %V = add i64 ptrtoint (i32* @X to i64), 0 + %B2 = shl i64 %V, 0 + %B4 = ashr i64 %B2, %L + %B = and i64 undef, %B4 + ret i64 %B +} + ; No one-use tests since we will only produce a single instruction here. ; Negative tests |