[llvm] r344243 - Generalize an IR verifier check to work with non-zero program address spaces

Dylan McKay via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 11 05:49:51 PDT 2018


Author: dylanmckay
Date: Thu Oct 11 05:49:50 2018
New Revision: 344243

URL: http://llvm.org/viewvc/llvm-project?rev=344243&view=rev
Log:
Generalize an IR verifier check to work with non-zero program address spaces

This commit modifies an existing IR verifier check that
assumes all functions will be located in the default address
space 0.

Rather than using the default paramater value getPointerTo(AddrSpace=0),
explicitly specify the program memory address space from the data layout.

This only affects targets that specify a nonzero address space
in their data layouts. The only in-tree target that does this
is AVR.

Modified:
    llvm/trunk/lib/IR/Verifier.cpp

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=344243&r1=344242&r2=344243&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Thu Oct 11 05:49:50 2018
@@ -632,7 +632,8 @@ void Verifier::visitGlobalVariable(const
     if (ArrayType *ATy = dyn_cast<ArrayType>(GV.getValueType())) {
       StructType *STy = dyn_cast<StructType>(ATy->getElementType());
       PointerType *FuncPtrTy =
-          FunctionType::get(Type::getVoidTy(Context), false)->getPointerTo();
+          FunctionType::get(Type::getVoidTy(Context), false)->
+          getPointerTo(DL.getProgramAddressSpace());
       // FIXME: Reject the 2-field form in LLVM 4.0.
       Assert(STy &&
                  (STy->getNumElements() == 2 || STy->getNumElements() == 3) &&




More information about the llvm-commits mailing list