File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -290,8 +290,10 @@ public func _onFastPath() {
290
290
Builtin . onFastPath ( )
291
291
}
292
292
293
- @_transparent
294
- public func _assume( _ condition: Bool ) {
293
+ // Optimizier hint that the condition is true. The condition is unchecked.
294
+ // The builtin acts as an opaque instruction with side-effects.
295
+ @usableFromInline @_transparent
296
+ func _uncheckedUnsafeAssume( _ condition: Bool ) {
295
297
_ = Builtin . assume_Int1 ( condition. _value)
296
298
}
297
299
Original file line number Diff line number Diff line change 2
2
3
3
// LLVM uses the assume intrinsic to strength reduce the division.
4
4
5
- // CHECK-LABEL: define swiftcc i64 @"$s1A10testAssumeyS2iF"(i64 )
6
- // CHECK: [[COND:%.*]] = icmp sgt i64 %0, -1
5
+ // CHECK-LABEL: define{{.*}} swiftcc i{{(64|32)}} @"$s1A10testAssumeyS2iF"(i{{(64|32)}} )
6
+ // CHECK: [[COND:%.*]] = icmp sgt i{{(64|32)}} %0, -1
7
7
// CHECK: tail call void @llvm.assume(i1 [[COND]])
8
- // CHECK: [[RES:%.*]] = lshr i64 %0, 6
9
- // CHECK: ret i64 [[RES]]
8
+ // CHECK: [[RES:%.*]] = lshr i{{(64|32)}} %0, 6
9
+ // CHECK: ret i{{(64|32)}} [[RES]]
10
10
11
11
public func testAssume( _ i: Int ) -> Int {
12
12
let cond = i >= 0
You can’t perform that action at this time.
0 commit comments