56 lines · plain
1; Test that incorrect memprof and callsite metadata fail verification.2; RUN: not llvm-as -disable-output < %s 2>&1 | FileCheck %s3 4define ptr @test1() {5entry:6 %call1 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40), !memprof !07 %call2 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40), !memprof !18 %call3 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40), !memprof !39 %call4 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40), !memprof !510 %call5 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40), !memprof !7, !callsite !911 ret ptr %call512}13 14define ptr @test2() {15entry:16 %call = call noundef ptr @test1(), !callsite !1017 ret ptr %call18}19 20define ptr @test3() {21entry:22 %call = call noundef ptr @test2(), !callsite !1123 ret ptr %call24}25 26define void @wronginsttype() {27 %1 = add i32 0, 1, !memprof !0, !callsite !928 ret void29}30 31declare dso_local noalias noundef ptr @malloc(i64 noundef)32 33; CHECK: !memprof annotations should have at least 1 metadata operand (MemInfoBlock)34!0 = !{}35!1 = !{!2}36; CHECK: !memprof MemInfoBlock first operand should not be null37!2 = !{null, !"cold"}38!3 = !{!4}39; CHECK: !memprof MemInfoBlock first operand should be an MDNode40!4 = !{i64 0, !"cold"}41!5 = !{!6}42; CHECK: Each !memprof MemInfoBlock should have at least 2 operands43!6 = !{i64 0}44!7 = !{!8}45; CHECK: call stack metadata should have at least 1 operand46; CHECK: Not all !memprof MemInfoBlock operands 2 to N are MDNode47!8 = !{!0, !"default", i64 0, i64 5}48!9 = !{i64 123}49; CHECK: call stack metadata operand should be constant integer50!10 = !{!"wrongtype"}51!11 = !{i64 789, i64 678}52 53; Errors from annotating incorrect instruction type in @wronginsttype.54; CHECK: !memprof metadata should only exist on calls55; CHECK: !callsite metadata should only exist on calls56