diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2018-12-07 15:38:13 +0000 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2018-12-07 15:38:13 +0000 |
| commit | 110cf05203caccd52373707044f4c37a785e85e3 (patch) | |
| tree | 2b724112f5af36e49f9562be1459fae165cf0957 /llvm/test/Transforms/LoopVectorize | |
| parent | b297379ef07829ac7f06c0e2058a889366c46a82 (diff) | |
| download | bcm5719-llvm-110cf05203caccd52373707044f4c37a785e85e3.tar.gz bcm5719-llvm-110cf05203caccd52373707044f4c37a785e85e3.zip | |
Reapply "[DemandedBits][BDCE] Support vectors of integers"
DemandedBits and BDCE currently only support scalar integers. This
patch extends them to also handle vector integer operations. In this
case bits are not tracked for individual vector elements, instead a
bit is demanded if it is demanded for any of the elements. This matches
the behavior of computeKnownBits in ValueTracking and
SimplifyDemandedBits in InstCombine.
Unlike the previous iteration of this patch, getDemandedBits() can now
again be called on arbirary (sized) instructions, even if they don't
have integer or vector of integer type. (For vector types the size of the
returned mask will now be the scalar size in bits though.)
The added LoopVectorize test case shows a case which triggered an
assertion failure with the previous attempt, because getDemandedBits()
was called on a pointer-typed instruction.
Differential Revision: https://reviews.llvm.org/D55297
llvm-svn: 348602
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize')
| -rw-r--r-- | llvm/test/Transforms/LoopVectorize/demanded-bits-of-pointer-instruction.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/demanded-bits-of-pointer-instruction.ll b/llvm/test/Transforms/LoopVectorize/demanded-bits-of-pointer-instruction.ll new file mode 100644 index 00000000000..1e5f18e371c --- /dev/null +++ b/llvm/test/Transforms/LoopVectorize/demanded-bits-of-pointer-instruction.ll @@ -0,0 +1,20 @@ +; RUN: opt < %s -loop-vectorize -S | FileCheck %s + +; getDemandedBits() is called on the pointer-typed GEP instruction here. +; Only make sure we do not crash. + +; CHECK: @test +define void @test(i8* %ptr, i8* %ptr_end) { +start: + br label %loop + +loop: + %ptr2 = phi i8* [ %ptr3, %loop ], [ %ptr, %start ] + %x = sext i8 undef to i64 + %ptr3 = getelementptr inbounds i8, i8* %ptr2, i64 1 + %cmp = icmp ult i8* %ptr3, %ptr_end + br i1 %cmp, label %loop, label %end + +end: + ret void +} |

