From 97bf57d488a1bfcf7128cc2dbc695f6901ae9be7 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 22 Apr 2013 15:16:51 +0000 Subject: [PATCH] Also verify llvm.compiler_used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180020 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Verifier.cpp | 3 ++- test/Verifier/llvm.compiler_used-invalid-type.ll | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 test/Verifier/llvm.compiler_used-invalid-type.ll diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index f7aa79cca39..888090db61e 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -449,7 +449,8 @@ void Verifier::visitGlobalVariable(GlobalVariable &GV) { } } - if (GV.hasName() && (GV.getName() == "llvm.used")) { + if (GV.hasName() && (GV.getName() == "llvm.used" || + GV.getName() == "llvm.compiler_used")) { Assert1(!GV.hasInitializer() || GV.hasAppendingLinkage(), "invalid linkage for intrinsic global variable", &GV); Type *GVType = GV.getType()->getElementType(); diff --git a/test/Verifier/llvm.compiler_used-invalid-type.ll b/test/Verifier/llvm.compiler_used-invalid-type.ll new file mode 100644 index 00000000000..0913027fb47 --- /dev/null +++ b/test/Verifier/llvm.compiler_used-invalid-type.ll @@ -0,0 +1,6 @@ +; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s + +@llvm.compiler_used = appending global [1 x i32] [i32 0], section "llvm.metadata" + +; CHECK: wrong type for intrinsic global variable +; CHECK-NEXT: [1 x i32]* @llvm.compiler_used -- 2.34.1