1 ; RUN: opt -instcombine -S < %s | FileCheck %s
3 target datalayout = "p:64:64:64"
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 i32, i32*
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 i64, i64*
47 %a = bitcast i8* %x to i64**
48 %b = load i64*, i64** %a
49 %c = ptrtoint i64* %b to i64
54 define i32 @test5(i8* %x) {
56 ; CHECK-LABEL: @test5(
57 ; CHECK: load i64, i64*
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 i64, i64*
72 %a = bitcast i8* %x to i32**
73 %b = load i32*, i32** %a
74 %c = ptrtoint i32* %b to i64