Krzysztof Parzyszek | 79b2433 | 2015-07-08 19:22:28 +0000 | [diff] [blame] | 1 | ; RUN: llc -O2 -march=hexagon < %s | FileCheck %s |
| 2 | ; CHECK: mpyi |
| 3 | ; CHECK-NOT: mpyi |
| 4 | ; The mpyis from the two GEPs should be commoned out. |
| 5 | |
| 6 | target datalayout = "e-m:e-p:32:32-i64:64-a:0-v32:32-n16:32" |
| 7 | target triple = "hexagon-unknown--elf" |
| 8 | |
| 9 | %struct.s_t = type { %struct.anon, i32 } |
| 10 | %struct.anon = type { i32, [5 x i32] } |
| 11 | |
| 12 | @g = common global [100 x %struct.s_t] zeroinitializer, align 8 |
| 13 | |
| 14 | ; Function Attrs: nounwind |
| 15 | define void @foo(i32 %x) #0 { |
| 16 | entry: |
| 17 | %cmp = icmp slt i32 %x, 90 |
| 18 | br i1 %cmp, label %if.then, label %if.else |
| 19 | |
| 20 | if.then: ; preds = %entry |
| 21 | %arrayidx1 = getelementptr inbounds [100 x %struct.s_t], [100 x %struct.s_t]* @g, i32 0, i32 %x, i32 0, i32 1, i32 2 |
| 22 | tail call void @bar(i32* %arrayidx1) #0 |
| 23 | br label %if.end |
| 24 | |
| 25 | if.else: ; preds = %entry |
| 26 | %arrayidx5 = getelementptr inbounds [100 x %struct.s_t], [100 x %struct.s_t]* @g, i32 0, i32 %x, i32 0, i32 1, i32 3 |
| 27 | tail call void @bar(i32* %arrayidx5) #0 |
| 28 | br label %if.end |
| 29 | |
| 30 | if.end: ; preds = %if.else, %if.then |
| 31 | ret void |
| 32 | } |
| 33 | |
| 34 | declare void @bar(i32*) #0 |
| 35 | |
| 36 | attributes #0 = { nounwind } |
| 37 | |