File tree Expand file tree Collapse file tree 2 files changed +26
-15
lines changed Expand file tree Collapse file tree 2 files changed +26
-15
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil-parse-stdlib -O -emit-ir %s | %FileCheck %s
2
+ sil_stage canonical
3
+
4
+ import Swift
5
+ import Builtin
6
+
7
+ // CHECK-LABEL: define{{.*}} swiftcc i64 @test_assume(i64)
8
+ // CHECK: [[COND:%.*]] = icmp sgt i64 %0, -1
9
+ // CHECK: tail call void @llvm.assume(i1 [[COND]])
10
+ // CHECK: [[RES:%.*]] = lshr i64 %0, 6
11
+ // CHECK: ret i64 [[RES]]
12
+ // CHECK: }
13
+
14
+ sil @test_assume : $@convention(thin) (Int) -> Int {
15
+ bb0(%0 : $Int):
16
+ %2 = integer_literal $Builtin.Int64, 0
17
+ %3 = struct_extract %0 : $Int, #Int._value
18
+ %4 = builtin "cmp_slt_Int64"(%3 : $Builtin.Int64, %2 : $Builtin.Int64) : $Builtin.Int1
19
+ %5 = integer_literal $Builtin.Int1, -1
20
+ %6 = builtin "xor_Int1"(%4 : $Builtin.Int1, %5 : $Builtin.Int1) : $Builtin.Int1
21
+ %7 = builtin "assume_Int1"(%6 : $Builtin.Int1) : $Builtin.Int1
22
+ %8 = integer_literal $Builtin.Int64, 64
23
+ %9 = builtin "sdiv_Int64"(%3 : $Builtin.Int64, %8 : $Builtin.Int64) : $Builtin.Int64
24
+ %10 = struct $Int (%9 : $Builtin.Int64)
25
+ return %10 : $Int
26
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments