summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/cast-load-gep.ll
blob: 0a369bce039b6acbb0c7921f6a05211a402f1ec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -globaldce | llvm-dis | not grep Array

; Pulling the cast out of the load allows us to eliminate the load, and then 
; the whole array.

%unop = type {int }
%op = type {float}

%Array = internal constant [1 x %op* (%op*)*] [ %op* (%op*)* %foo ]

implementation

%op* %foo(%op* %X) {
  ret %op* %X
}

%unop* %caller(%op* %O) {
   %tmp = load %unop* (%op*)** cast ([1 x %op* (%op*)*]* %Array to %unop* (%op*)**)
   %tmp.2 = call %unop* (%op*)* %tmp(%op* %O)
   ret %unop* %tmp.2
}