As discussed in https://github.com/llvm/llvm-project/issues/59901 This change is not NFC. There is one SCEV and EarlyCSE test that have an improved analysis/optimization case. Rest of the tests are not failing. I've mostly only added cleanup to SCEV since that is where this issue started. As a follow up, I believe there is more cleanup opportunity in SCEV and other affected passes. There could be cases where there are missed registerAssumption of guards, but this case is not so bad because there will be no miscompilation. AssumptionCacheTracker should take care of deleted guards. Differential Revision: https://reviews.llvm.org/D142330
30 lines
912 B
LLVM
30 lines
912 B
LLVM
; RUN: opt < %s -disable-output -passes='print<assumptions>' 2>&1 | FileCheck %s
|
|
|
|
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
declare void @llvm.assume(i1)
|
|
declare void @llvm.experimental.guard(i1, ...)
|
|
|
|
define void @test1(i32 %a) {
|
|
; CHECK-LABEL: Cached assumptions for function: test1
|
|
; CHECK-NEXT: icmp ne i32 %{{.*}}, 0
|
|
; CHECK-NEXT: icmp slt i32 %{{.*}}, 0
|
|
; CHECK-NEXT: icmp sgt i32 %{{.*}}, 0
|
|
; CHECK-NEXT: icmp ult i32 %{{.*}}, 0
|
|
; CHECK-NEXT: icmp ugt i32 %{{.*}}, 0
|
|
|
|
entry:
|
|
%cond1 = icmp ne i32 %a, 0
|
|
call void @llvm.assume(i1 %cond1)
|
|
%cond2 = icmp slt i32 %a, 0
|
|
call void @llvm.assume(i1 %cond2)
|
|
%cond3 = icmp sgt i32 %a, 0
|
|
call void @llvm.assume(i1 %cond3)
|
|
%cond4 = icmp ult i32 %a, 0
|
|
call void (i1, ...) @llvm.experimental.guard(i1 %cond4) [ "deopt"() ]
|
|
%cond5 = icmp ugt i32 %a, 0
|
|
call void (i1, ...) @llvm.experimental.guard(i1 %cond5) [ "deopt"() ]
|
|
|
|
ret void
|
|
}
|