llvm/llvm/test/Transforms/InferAlignment/volatile.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt < %s -passes=infer-alignment -S | FileCheck %s

define void @load_volatile() {
; CHECK-LABEL: define void @load_volatile() {
; CHECK-NEXT:    [[A:%.*]] = alloca { i32 }, align 8
; CHECK-NEXT:    [[B:%.*]] = alloca i32, align 4
; CHECK-NEXT:    [[LOAD_A:%.*]] = load volatile i32, ptr [[A]], align 8
; CHECK-NEXT:    [[LOAD_B:%.*]] = load volatile i32, ptr [[B]], align 4
; CHECK-NEXT:    ret void
;
  %a = alloca { i32 }
  %b = alloca i32
  %load.a = load volatile i32, ptr %a
  %load.b = load volatile i32, ptr %b
  ret void
}

define void @store_volatile() {
; CHECK-LABEL: define void @store_volatile() {
; CHECK-NEXT:    [[A:%.*]] = alloca { i32 }, align 8
; CHECK-NEXT:    [[B:%.*]] = alloca i32, align 4
; CHECK-NEXT:    store volatile i32 123, ptr [[A]], align 8
; CHECK-NEXT:    store volatile i32 123, ptr [[B]], align 4
; CHECK-NEXT:    ret void
;
  %a = alloca { i32 }
  %b = alloca i32
  store volatile i32 123, ptr %a
  store volatile i32 123, ptr %b
  ret void
}