llvm/llvm/test/Analysis/CostModel/SystemZ/struct-cost-crash.ll

; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 2
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output < %s | FileCheck %s
;
; Check that SystemZTTIImpl::getMemoryOpCost doesn't try to legalize structs,
; which was failing llvm_unreachable in MVT::getVT.

target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
target triple = "s390x-unknown-linux-gnu"

declare { i64, i32 } @bar()

define i8 @foo() {
; CHECK-LABEL: 'foo'
; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: br label %1
; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %2 = call { i64, i32 } @bar()
; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: store { i64, i32 } %2, ptr inttoptr (i64 16 to ptr), align 16
; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: br label %1
;
  br label %1

1:                                                ; preds = %1, %0
  %2 = call { i64, i32 } @bar()
  store { i64, i32 } %2, ptr inttoptr (i64 16 to ptr), align 16
  br label %1
}