[ValueTracking] Move GlobalAlias handling to be after the max depth check in computeK...
[oota-llvm.git] / test / Transforms / InstCombine / alias-recursion.ll
1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-pc-windows-msvc"
5
6 %class.A = type { i32 (...)** }
7
8 @0 = constant [1 x i8*] zeroinitializer
9
10 @vtbl = alias getelementptr inbounds ([1 x i8*]* @0, i32 0, i32 0)
11
12 define i32 (%class.A*)* @test() {
13 ; CHECK-LABEL: test
14 entry:
15   br i1 undef, label %for.body, label %for.end
16
17 for.body:                                         ; preds = %for.body, %entry
18   br i1 undef, label %for.body, label %for.end
19
20 for.end:                                          ; preds = %for.body, %entry
21   %A = phi i32 (%class.A*)** [ bitcast (i8** @vtbl to i32 (%class.A*)**), %for.body ], [ null, %entry ]
22   %B = load i32 (%class.A*)** %A
23   ret i32 (%class.A*)* %B
24 }