mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
34a5b0392e
D70365 allows us to make attributes default. This is a follow up to actually make nosync, nofree and willreturn default. The approach we chose, for now, is to opt-in to default attributes to avoid introducing problems to target specific intrinsics. Intrinsics with default attributes can be created using `DefaultAttrsIntrinsic` class.
20 lines
725 B
LLVM
20 lines
725 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
|
|
declare void @llvm.experimental.guard(i1, ...)
|
|
|
|
; Regression test. If %flag is false then %s == 0 and guard should be triggered.
|
|
define i32 @a(i1 %flag, i32 %X) nounwind readnone {
|
|
; CHECK-LABEL: @a(
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[X:%.*]], 0
|
|
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[CMP]]) #2 [ "deopt"() ]
|
|
; CHECK-NEXT: [[R:%.*]] = sdiv i32 100, [[X]]
|
|
; CHECK-NEXT: ret i32 [[R]]
|
|
;
|
|
%s = select i1 %flag, i32 %X, i32 0
|
|
%cmp = icmp ne i32 %s, 0
|
|
call void(i1, ...) @llvm.experimental.guard( i1 %cmp )[ "deopt"() ]
|
|
%r = sdiv i32 100, %s
|
|
ret i32 %r
|
|
}
|