57 lines · plain
1;; Check all requirements on the ptrtoaddr constant expression operands2;; Most of these invalid cases are detected at parse time but some are only3;; detected at verification time (see Verifier::visitPtrToAddrInst())4; RUN: rm -rf %t && split-file --leading-lines %s %t5 6;--- src_vec_dst_no_vec.ll7; RUN: not llvm-as %t/src_vec_dst_no_vec.ll -o /dev/null 2>&1 | FileCheck -check-prefix=SRC_VEC_DST_NO_VEC %s --implicit-check-not="error:"8@g = global i64 ptrtoaddr (<2 x ptr> <ptr @g, ptr @g> to i64)9; SRC_VEC_DST_NO_VEC: [[#@LINE-1]]:17: error: invalid cast opcode for cast from '<2 x ptr>' to 'i64'10 11;--- src_no_vec_dst_vec.ll12; RUN: not llvm-as %t/src_no_vec_dst_vec.ll -o /dev/null 2>&1 | FileCheck -check-prefix=SRC_NO_VEC_DST_VEC %s --implicit-check-not="error:"13@g = global <2 x i64> ptrtoaddr (ptr @g to <2 x i64>)14; SRC_NO_VEC_DST_VEC: [[#@LINE-1]]:23: error: invalid cast opcode for cast from 'ptr' to '<2 x i64>'15 16;--- dst_not_int.ll17; RUN: not llvm-as %t/dst_not_int.ll -o /dev/null 2>&1 | FileCheck -check-prefix=DST_NOT_INT %s --implicit-check-not="error:"18@g = global float ptrtoaddr (ptr @g to float)19; DST_NOT_INT: [[#@LINE-1]]:19: error: invalid cast opcode for cast from 'ptr' to 'float'20 21;--- dst_not_int_vec.ll22; RUN: not llvm-as %t/dst_not_int_vec.ll -o /dev/null 2>&1 | FileCheck -check-prefix=DST_NOT_INT_VEC %s --implicit-check-not="error:"23@g = global <2 x float> ptrtoaddr (<2 x ptr> <ptr @g, ptr @g> to <2 x float>)24; DST_NOT_INT_VEC: [[#@LINE-1]]:25: error: invalid cast opcode for cast from '<2 x ptr>' to '<2 x float>'25 26;--- src_not_ptr.ll27; RUN: not llvm-as %t/src_not_ptr.ll -o /dev/null 2>&1 | FileCheck -check-prefix=SRC_NOT_PTR %s --implicit-check-not="error:"28@g = global i64 ptrtoaddr (i32 1 to i64)29; SRC_NOT_PTR: [[#@LINE-1]]:17: error: invalid cast opcode for cast from 'i32' to 'i64'30 31;--- src_not_ptr_vec.ll32; RUN: not llvm-as %t/src_not_ptr_vec.ll -o /dev/null 2>&1 | FileCheck -check-prefix=SRC_NOT_PTR_VEC %s --implicit-check-not="error:"33@g = global <2 x i64> ptrtoaddr (<2 x i32> <i32 1, i32 2> to <2 x i64>)34; SRC_NOT_PTR_VEC: [[#@LINE-1]]:23: error: invalid cast opcode for cast from '<2 x i32>' to '<2 x i64>'35 36;--- vec_src_fewer_elems.ll37; RUN: not llvm-as %t/vec_src_fewer_elems.ll -o /dev/null 2>&1 | FileCheck -check-prefix=VEC_SRC_FEWER_ELEMS %s --implicit-check-not="error:"38@g = global <4 x i64> ptrtoaddr (<2 x ptr> <ptr @g, ptr @g> to <4 x i64>)39; VEC_SRC_FEWER_ELEMS: [[#@LINE-1]]:23: error: invalid cast opcode for cast from '<2 x ptr>' to '<4 x i64>'40 41;--- vec_dst_fewer_elems.ll42; RUN: not llvm-as %t/vec_dst_fewer_elems.ll -o /dev/null 2>&1 | FileCheck -check-prefix=VEC_DST_FEWER_ELEMS %s --implicit-check-not="error:"43@g = global <2 x i64> ptrtoaddr (<4 x ptr> <ptr @g, ptr @g, ptr @g, ptr @g> to <2 x i64>)44; VEC_DST_FEWER_ELEMS: [[#@LINE-1]]:23: error: invalid cast opcode for cast from '<4 x ptr>' to '<2 x i64>'45 46;--- dst_not_addr_size.ll47; The following invalid IR is caught by the verifier, not the parser:48; RUN: llvm-as %t/dst_not_addr_size.ll --disable-output --disable-verify49; RUN: not llvm-as %t/dst_not_addr_size.ll -o /dev/null 2>&1 | FileCheck -check-prefix=DST_NOT_ADDR_SIZE %s --implicit-check-not="error:"50; DST_NOT_ADDR_SIZE: assembly parsed, but does not verify as correct!51@g = global i32 ptrtoaddr (ptr @g to i32)52; DST_NOT_ADDR_SIZE-NEXT: PtrToAddr result must be address width53; DST_NOT_ADDR_SIZE-NEXT: i32 ptrtoaddr (ptr @g to i32)54@g_vec = global <4 x i32> ptrtoaddr (<4 x ptr> <ptr @g, ptr @g, ptr @g, ptr @g> to <4 x i32>)55; TODO: Verifier.cpp does not visit ConstantVector/ConstantStruct values56; TODO-DST_NOT_ADDR_SIZE: PtrToAddr result must be address width57