llvm/llvm/test/Transforms/InstCombine/vscale_load.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine,verify -S | FileCheck %s

define <2 x i8> @constprop_load_bitcast(ptr %ptr) {
; CHECK-LABEL: @constprop_load_bitcast(
; CHECK-NEXT:    store <vscale x 16 x i1> zeroinitializer, ptr [[PTR:%.*]], align 16
; CHECK-NEXT:    ret <2 x i8> zeroinitializer
;
  store <vscale x 16 x i1> zeroinitializer, ptr %ptr, align 16
  %a = load <2 x i8>, ptr %ptr, align 16
  ret <2 x i8> %a
}

; vscale-sized vec not guaranteed to fill destination.
define <8 x i8> @constprop_load_bitcast_neg(ptr %ptr) {
; CHECK-LABEL: @constprop_load_bitcast_neg(
; CHECK-NEXT:    store <vscale x 16 x i1> zeroinitializer, ptr [[PTR:%.*]], align 16
; CHECK-NEXT:    [[A:%.*]] = load <8 x i8>, ptr [[PTR]], align 16
; CHECK-NEXT:    ret <8 x i8> [[A]]
;
  store <vscale x 16 x i1> zeroinitializer, ptr %ptr, align 16
  %a = load <8 x i8>, ptr %ptr, align 16
  ret <8 x i8> %a
}