Artur Pilipenko | 5c5011d | 2015-11-02 17:53:51 +0000 | [diff] [blame] | 1 | ; RUN: opt -instcombine -S < %s | FileCheck %s |
| 2 | |
| 3 | declare void @bar() |
| 4 | declare void @baz() |
| 5 | |
| 6 | ; Check that dereferenceable metadata is combined |
| 7 | ; CHECK-LABEL: cont: |
| 8 | ; CHECK: load i32*, i32** |
| 9 | ; CHECK-SAME: !dereferenceable ![[DEREF:[0-9]+]] |
| 10 | define i32* @test_phi_combine_load_metadata(i1 %c, i32** dereferenceable(8) %p1, i32** dereferenceable(8) %p2) { |
| 11 | br i1 %c, label %t, label %f |
| 12 | t: |
| 13 | call void @bar() |
| 14 | %v1 = load i32*, i32** %p1, align 8, !dereferenceable !0 |
| 15 | br label %cont |
| 16 | |
| 17 | f: |
| 18 | call void @baz() |
| 19 | %v2 = load i32*, i32** %p2, align 8, !dereferenceable !1 |
| 20 | br label %cont |
| 21 | |
| 22 | cont: |
| 23 | %res = phi i32* [ %v1, %t ], [ %v2, %f ] |
| 24 | ret i32* %res |
| 25 | } |
| 26 | |
| 27 | ; CHECK: ![[DEREF]] = !{i64 8} |
| 28 | |
| 29 | !0 = !{i64 8} |
| 30 | !1 = !{i64 16} |