Index: ARMFastISel.cpp =================================================================== --- ARMFastISel.cpp +++ ARMFastISel.cpp @@ -2195,10 +2195,9 @@ Type *GVTy = Type::getInt32PtrTy(*Context, /*AS=*/0); EVT LCREVT = TLI.getValueType(DL, GVTy); if (!LCREVT.isSimple()) return 0; - - GlobalValue *GV = new GlobalVariable(M, Type::getInt32Ty(*Context), false, - GlobalValue::ExternalLinkage, nullptr, - Name); + GlobalValue *GV = cast (M.getOrInsertGlobal( + Name.getSingleStringRef(), + Type::getInt32Ty(*Context))); assert(GV->getType() == GVTy && "We miscomputed the type for the global!"); return ARMMaterializeGV(GV, LCREVT.getSimpleVT()); }