Skip to content

Commit 342eca2

Browse files
committed
[NFC][Codegen] Add miscompile test for constant store merging from PR43446
This miscompile was introduced by rL354676 / https://reviews.llvm.org/D58468 https://bugs.llvm.org/show_bug.cgi?id=43446
1 parent bf6d94f commit 342eca2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

llvm/test/CodeGen/X86/stores-merging.ll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,26 @@ define void @extract_vector_store_32_consecutive_bytes(<4 x i64> %v, i8* %ptr) #
219219
ret void
220220
}
221221

222+
; These are miscompiles - we should store '1', not '-1'.
223+
; https://bugs.llvm.org/show_bug.cgi?id=43446
224+
define void @pr43446_0(i64 %x) {
225+
; CHECK-LABEL: pr43446_0:
226+
; CHECK: # %bb.0:
227+
; CHECK-NEXT: movb $-1, (%rdi)
228+
; CHECK-NEXT: retq
229+
%a = inttoptr i64 %x to i8*
230+
store i8 -2, i8* %a, align 1
231+
%b = inttoptr i64 %x to i1*
232+
store i1 true, i1* %b, align 1
233+
ret void
234+
}
235+
define void @pr43446_1(i8* %a) {
236+
; CHECK-LABEL: pr43446_1:
237+
; CHECK: # %bb.0:
238+
; CHECK-NEXT: movb $-1, (%rdi)
239+
; CHECK-NEXT: retq
240+
store i8 -2, i8* %a, align 1
241+
%b = bitcast i8* %a to i1*
242+
store i1 true, i1* %b, align 1
243+
ret void
244+
}

0 commit comments

Comments
 (0)