[NFC] Add test case showing the miscompile being fixed by D83507

See https://reviews.llvm.org/D83507
This commit is contained in:
Roman Lebedev 2020-08-13 16:04:34 +03:00
parent e8ebebb0bd
commit 3bd2513ebd
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -O1 -enable-knowledge-retention -S < %s | FileCheck %s --check-prefixes=ANY,OLDPM
; RUN: opt -passes='default<O1>' -enable-knowledge-retention -S < %s | FileCheck %s --check-prefixes=ANY,NEWPM
%0 = type { %0* }
define %0* @f1() local_unnamed_addr {
; ANY-LABEL: @f1(
; ANY-NEXT: bb:
; ANY-NEXT: br label [[BB3:%.*]]
; ANY: bb3:
; ANY-NEXT: [[I1:%.*]] = phi %0* [ [[I5:%.*]], [[BB3]] ], [ undef, [[BB:%.*]] ]
; ANY-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(%0* [[I1]]) ]
; ANY-NEXT: [[I4:%.*]] = getelementptr inbounds [[TMP0:%.*]], %0* [[I1]], i64 0, i32 0
; ANY-NEXT: [[I5]] = load %0*, %0** [[I4]], align 8
; ANY-NEXT: br label [[BB3]]
;
bb:
br label %bb1
bb1:
%i = phi %0* [ undef, %bb ], [ %i5, %bb3 ]
%i2 = icmp eq %0* %i, null
br i1 %i2, label %bb6, label %bb3
bb3:
call void @llvm.assume(i1 true) [ "nonnull"(%0* %i) ]
%i4 = getelementptr inbounds %0, %0* %i, i64 0, i32 0
%i5 = load %0*, %0** %i4, align 8
br label %bb1
bb6:
ret %0* undef
}
declare void @llvm.assume(i1)