1 ; RUN: opt -instcombine -S < %s | FileCheck %s
3 target datalayout = "p:32:32:32"
6 define i64* @test1(i8* %x) {
9 ; CHECK: load i64, i64*
11 %a = bitcast i8* %x to i64*
12 %b = load i64, i64* %a
13 %c = inttoptr i64 %b to i64*
18 define i32* @test2(i8* %x) {
20 ; CHECK-LABEL: @test2(
21 ; CHECK: load i32*, i32**
23 %a = bitcast i8* %x to i32*
24 %b = load i32, i32* %a
25 %c = inttoptr i32 %b to i32*
30 define i64* @test3(i8* %x) {
32 ; CHECK-LABEL: @test3(
33 ; CHECK: load i64*, i64**
35 %a = bitcast i8* %x to i32*
36 %b = load i32, i32* %a
37 %c = inttoptr i32 %b to i64*
42 define i64 @test4(i8* %x) {
44 ; CHECK-LABEL: @test4(
45 ; CHECK: load i32, i32*
48 %a = bitcast i8* %x to i64**
49 %b = load i64*, i64** %a
50 %c = ptrtoint i64* %b to i64
55 define i32 @test5(i8* %x) {
57 ; CHECK-LABEL: @test5(
58 ; CHECK: load i32, i32*
60 %a = bitcast i8* %x to i32**
61 %b = load i32*, i32** %a
62 %c = ptrtoint i32* %b to i32
67 define i64 @test6(i8* %x) {
69 ; CHECK-LABEL: @test6(
70 ; CHECK: load i32, i32*
73 %a = bitcast i8* %x to i32**
74 %b = load i32*, i32** %a
75 %c = ptrtoint i32* %b to i64