llvm/llvm/test/CodeGen/AMDGPU/GlobalISel/postlegalizer-combiner-freeze.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs -o - %s | FileCheck %s

---
name: test_freeze_freeze_s32
tracksRegLiveness: true
legalized: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: test_freeze_freeze_s32
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src0:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: %freeze0:_(s32) = G_FREEZE %src0
    ; CHECK-NEXT: %ptr:_(p1) = G_IMPLICIT_DEF
    ; CHECK-NEXT: G_STORE %freeze0(s32), %ptr(p1) :: (store (s32), addrspace 1)
    %src0:_(s32) = COPY $vgpr0
    %freeze0:_(s32) = G_FREEZE %src0
    %freeze1:_(s32) = G_FREEZE %freeze0
    %ptr:_(p1) = G_IMPLICIT_DEF
    G_STORE %freeze1, %ptr :: (store (s32), addrspace 1, align 4)
...

---
name: test_freeze_freeze_freeze_s32
tracksRegLiveness: true
legalized: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: test_freeze_freeze_freeze_s32
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src0:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: %freeze0:_(s32) = G_FREEZE %src0
    ; CHECK-NEXT: %ptr:_(p1) = G_IMPLICIT_DEF
    ; CHECK-NEXT: G_STORE %freeze0(s32), %ptr(p1) :: (store (s32), addrspace 1)
    %src0:_(s32) = COPY $vgpr0
    %freeze0:_(s32) = G_FREEZE %src0
    %freeze1:_(s32) = G_FREEZE %freeze0
    %freeze2:_(s32) = G_FREEZE %freeze1
    %ptr:_(p1) = G_IMPLICIT_DEF
    G_STORE %freeze2, %ptr :: (store (s32), addrspace 1, align 4)
...

---
name: test_freeze_freeze_s32_multi_use
tracksRegLiveness: true
legalized: true
body: |
  bb.0:
    liveins: $vgpr0

    ; CHECK-LABEL: name: test_freeze_freeze_s32_multi_use
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src0:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: %ptr:_(p1) = G_IMPLICIT_DEF
    ; CHECK-NEXT: %freeze0:_(s32) = G_FREEZE %src0
    ; CHECK-NEXT: G_STORE %freeze0(s32), %ptr(p1) :: (volatile store (s32), addrspace 1)
    ; CHECK-NEXT: G_STORE %freeze0(s32), %ptr(p1) :: (volatile store (s32), addrspace 1)
    ; CHECK-NEXT: G_STORE %freeze0(s32), %ptr(p1) :: (volatile store (s32), addrspace 1)
    %src0:_(s32) = COPY $vgpr0
    %ptr:_(p1) = G_IMPLICIT_DEF

    %freeze0:_(s32) = G_FREEZE %src0
    G_STORE %freeze0, %ptr :: (volatile store (s32), addrspace 1, align 4)

    %freeze1:_(s32) = G_FREEZE %freeze0
    G_STORE %freeze1, %ptr :: (volatile store (s32), addrspace 1, align 4)

    G_STORE %freeze1, %ptr :: (volatile store (s32), addrspace 1, align 4)
...

---
name: test_freeze_copy_freeze_s32
tracksRegLiveness: true
legalized: true
body: |
  bb.0:
    liveins: $vgpr0
    ; CHECK-LABEL: name: test_freeze_copy_freeze_s32
    ; CHECK: liveins: $vgpr0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: %src0:_(s32) = COPY $vgpr0
    ; CHECK-NEXT: %freeze0:_(s32) = G_FREEZE %src0
    ; CHECK-NEXT: %ptr:_(p1) = G_IMPLICIT_DEF
    ; CHECK-NEXT: G_STORE %freeze0(s32), %ptr(p1) :: (store (s32), addrspace 1)
    %src0:_(s32) = COPY $vgpr0
    %freeze0:_(s32) = G_FREEZE %src0
    %copy:_(s32) = COPY %freeze0
    %freeze1:_(s32) = G_FREEZE %copy
    %ptr:_(p1) = G_IMPLICIT_DEF
    G_STORE %freeze1, %ptr :: (store (s32), addrspace 1, align 4)
...