blob: 3a458e481936709ecc406355a8b5135f14917df3 [file] [log] [blame]
Saleem Abdulrasool72587352014-04-03 16:01:44 +00001; RUN: llc -mtriple arm-eabi -mcpu swift -verify-machineinstrs %s -o /dev/null
Matthias Braund616ccc2013-10-11 19:04:37 +00002
3declare i32 @f(i32 %p0, i32 %p1)
4
5define i32 @foo(i32* %ptr) {
6entry:
7 %cmp = icmp ne i32* %ptr, null
8 br i1 %cmp, label %if.then, label %if.else
9
10; present something which can be easily if-converted
11if.then:
12 ; %R0 should be killed here
David Blaikiea79ac142015-02-27 21:17:42 +000013 %valt = load i32, i32* %ptr, align 4
Matthias Braund616ccc2013-10-11 19:04:37 +000014 br label %return
15
16if.else:
17 ; %R0 should be killed here, however after if-conversion the %R0 kill
18 ; has to be removed because if.then will follow after this and still
19 ; read it.
David Blaikie79e6c742015-02-27 19:29:02 +000020 %addr = getelementptr inbounds i32, i32* %ptr, i32 4
David Blaikiea79ac142015-02-27 21:17:42 +000021 %vale = load i32, i32* %addr, align 4
Matthias Braund616ccc2013-10-11 19:04:37 +000022 br label %return
23
24return:
25 %phival = phi i32 [ %valt, %if.then ], [ %vale, %if.else ]
26 ; suggest to bring %phival/%valt/%vale into %R1 (because otherwise there
27 ; will be no kills in if.then/if.else)
28 %retval = call i32 @f (i32 0, i32 %phival)
29 ret i32 %retval
30}