1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Make the test introduced in r239015 more targeted.

We don't need to go through LSR to trigger this bug.  Instead,
hand-craft a tricky GEP and get the constant folder to hack on it when
parsing the IR.

llvm-svn: 239017
This commit is contained in:
David Majnemer 2015-06-04 07:21:42 +00:00
parent 2b7fd2c6ef
commit 3c1a9b7d86
2 changed files with 4 additions and 29 deletions

View File

@ -19,6 +19,10 @@
@y = global i32* getelementptr ({ i32, i32 }, { i32, i32 }* @x, i16 42, i32 0)
; CHECK: @y = global i32* getelementptr ({ i32, i32 }, { i32, i32 }* @x, i16 42, i32 0)
@PR23753_a = external global i8
@PR23753_b = global i8* getelementptr (i8, i8* @PR23753_a, i64 ptrtoint (i8* @PR23753_a to i64))
; CHECK: @PR23753_b = global i8* getelementptr (i8, i8* @PR23753_a, i64 ptrtoint (i8* @PR23753_a to i64))
; See if i92 indices work too.
define i32 *@test({i32, i32}* %t, i92 %n) {
; CHECK: @test

View File

@ -1,29 +0,0 @@
; RUN: opt < %s -loop-reduce -S | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@a = external global i32, align 4
@d = external global i8, align 1
; CHECK-LABEL: void @f
define void @f() {
entry:
br label %for.body
for.body:
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* @a, i64 %indvars.iv
%cmp = icmp ne i32* %arrayidx, bitcast (i8* @d to i32*)
%indvars.iv.next = add i64 %indvars.iv, 1
br i1 %cmp, label %for.body, label %for.end
; CHECK: %[[phi:.*]] = phi i8* [ %[[gep:.*]], {{.*}} ], [ getelementptr (i8, i8* @d, i64 sub (i64 4, i64 ptrtoint (i32* @a to i64))), {{.*}} ]
; CHECK-NEXT: %[[gep]] = getelementptr i8, i8* %[[phi]], i64 -4
; CHECK-NEXT: %[[cst:.*]] = bitcast i8* %[[gep]] to i32*
; CHECK-NEXT: %[[cmp:.*]] = icmp ne i32* %[[cst]], null
; CHECK-NEXT: br i1 %[[cmp]]
for.end:
ret void
}