Tim Northover | e2239ff | 2014-07-29 10:20:22 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -codegenprepare -mtriple=arm64-apple-ios7.0 %s | FileCheck %s |
| 2 | |
| 3 | %foo = type { i8 } |
| 4 | |
| 5 | define %foo @test_merge(i32 %in) { |
| 6 | ; CHECK-LABEL: @test_merge |
| 7 | |
| 8 | ; CodeGenPrepare was requesting the EVT for { i8 } to determine |
| 9 | ; whether the insertvalue user of the trunc was legal. This |
| 10 | ; asserted. |
| 11 | |
| 12 | ; CHECK: insertvalue %foo undef, i8 %byte, 0 |
| 13 | %lobit = lshr i32 %in, 31 |
| 14 | %byte = trunc i32 %lobit to i8 |
| 15 | %struct = insertvalue %foo undef, i8 %byte, 0 |
| 16 | ret %"foo" %struct |
| 17 | } |
Ahmed Bougacha | 0788d49 | 2014-11-12 22:16:55 +0000 | [diff] [blame] | 18 | |
| 19 | define i64* @test_merge_PR21548(i32 %a, i64* %p1, i64* %p2, i64* %p3) { |
| 20 | ; CHECK-LABEL: @test_merge_PR21548 |
| 21 | %as = lshr i32 %a, 3 |
| 22 | %Tr = trunc i32 %as to i1 |
| 23 | br i1 %Tr, label %BB2, label %BB3 |
| 24 | |
| 25 | BB2: |
| 26 | ; Similarly to above: |
| 27 | ; CodeGenPrepare was requesting the EVT for i8* to determine |
| 28 | ; whether the select user of the trunc was legal. This asserted. |
| 29 | |
| 30 | ; CHECK: select i1 {{%.*}}, i64* %p1, i64* %p2 |
| 31 | %p = select i1 %Tr, i64* %p1, i64* %p2 |
| 32 | ret i64* %p |
| 33 | |
| 34 | BB3: |
| 35 | ret i64* %p3 |
| 36 | } |