mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
c1f65c8564
This is the first commit in a series that add an @llvm.assume intrinsic which can be used to provide the optimizer with a condition it may assume to be true (when the control flow would hit the intrinsic call). Some basic properties are added here: - llvm.invariant(true) is dead. - llvm.invariant(false) is unreachable (this directly corresponds to the documented behavior of MSVC's __assume(0)), so is llvm.invariant(undef). The intrinsic is tagged as writing arbitrarily, in order to maintain control dependencies. BasicAA has been updated, however, to return NoModRef for any particular location-based query so that we don't unnecessarily block code motion. llvm-svn: 213973
23 lines
390 B
LLVM
23 lines
390 B
LLVM
; RUN: opt -simplifycfg -S < %s | FileCheck %s
|
|
|
|
define void @test1() {
|
|
call void @llvm.assume(i1 0)
|
|
ret void
|
|
|
|
; CHECK-LABEL: @test1
|
|
; CHECK-NOT: llvm.assume
|
|
; CHECK: unreachable
|
|
}
|
|
|
|
define void @test2() {
|
|
call void @llvm.assume(i1 undef)
|
|
ret void
|
|
|
|
; CHECK-LABEL: @test2
|
|
; CHECK-NOT: llvm.assume
|
|
; CHECK: unreachable
|
|
}
|
|
|
|
declare void @llvm.assume(i1) nounwind
|
|
|