1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/test/Transforms/GVN/pr28879.ll
Matthew Voss 223cb7d841 [GVN] Avoid casting a vector of size less than 8 bits to i8
Summary:
A reprise of D25849.

This crash was found through fuzzing some time ago and was documented in PR28879.

No check for load size has been added due to the following tests:
  - Transforms/GVN/invariant.group.ll
  - Transforms/GVN/pr10820.ll

These tests expect load sizes that are not a multiple of eight.

Thanks to @davide for the original patch.

Reviewers: nlopes, davide, RKSimon, reames, efriedma

Reviewed By: efriedma

Subscribers: davide, llvm-commits, Prazek

Differential Revision: https://reviews.llvm.org/D48330

llvm-svn: 335294
2018-06-21 21:43:20 +00:00

35 lines
832 B
LLVM

; RUN: opt -gvn <%s -S -o - | FileCheck %s
define void @f() {
entry:
%a = alloca <7 x i1>, align 2
store <7 x i1> undef, <7 x i1>* %a, align 2
; CHECK: store <7 x i1> undef, <7 x i1>*
%0 = getelementptr inbounds <7 x i1>, <7 x i1>* %a, i64 0, i64 0
%val = load i1, i1* %0, align 2
; CHECK: load i1, i1*
br i1 %val, label %cond.true, label %cond.false
cond.true:
ret void
cond.false:
ret void
}
define <7 x i1> @g(<7 x i1>* %a) {
entry:
%vec = load <7 x i1>, <7 x i1>* %a
; CHECK: load <7 x i1>, <7 x i1>*
%0 = getelementptr inbounds <7 x i1>, <7 x i1>* %a, i64 0, i64 0
%val = load i1, i1* %0, align 2
; CHECK: load i1, i1*
br i1 %val, label %cond.true, label %cond.false
cond.true:
ret <7 x i1> %vec
cond.false:
ret <7 x i1> <i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false>
}