1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
3
4; PR46195 - https://bugs.llvm.org/show_bug.cgi?id=46195
5; It is not safe to sink the load after the call.
6
7define void @translate(i16* %ptr) nounwind {
8; CHECK-LABEL: translate:
9; CHECK:       # %bb.0:
10; CHECK-NEXT:    pushq %rbp
11; CHECK-NEXT:    pushq %rbx
12; CHECK-NEXT:    pushq %rax
13; CHECK-NEXT:    movq %rdi, %rbx
14; CHECK-NEXT:    movl $-32707, %ebp # imm = 0x803D
15; CHECK-NEXT:    andl (%rdi), %ebp
16; CHECK-NEXT:    callq maybe_mutate@PLT
17; CHECK-NEXT:    orl $514, %ebp # imm = 0x202
18; CHECK-NEXT:    movw %bp, (%rbx)
19; CHECK-NEXT:    addq $8, %rsp
20; CHECK-NEXT:    popq %rbx
21; CHECK-NEXT:    popq %rbp
22; CHECK-NEXT:    retq
23  %i0 = load i16, i16* %ptr, align 4
24  call void @maybe_mutate(i16* %ptr)
25  %i1 = and i16 %i0, -32707
26  %i2 = or i16 %i1, 514
27  store i16 %i2, i16* %ptr, align 4
28  ret void
29}
30
31declare void @maybe_mutate(i16*)
32