Skip to content

Commit fa5fdfb

Browse files
[CodeGen] Remove extraneous ArrayRef (NFC) (#88601)
We don't need to create these instances of ArrayRef because StructType::create and ConstantStruct::get take ArrayRef, and ArrayRef can be implicitly constructed from C arrays.
1 parent b570eb5 commit fa5fdfb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/CodeGen/LowerEmuTLS.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ bool addEmuTlsVar(Module &M, const GlobalVariable *GV) {
139139
IntegerType *WordType = DL.getIntPtrType(C);
140140
PointerType *InitPtrType = PointerType::getUnqual(C);
141141
Type *ElementTypes[4] = {WordType, WordType, VoidPtrType, InitPtrType};
142-
ArrayRef<Type*> ElementTypeArray(ElementTypes, 4);
143-
StructType *EmuTlsVarType = StructType::create(ElementTypeArray);
142+
StructType *EmuTlsVarType = StructType::create(ElementTypes);
144143
EmuTlsVar = cast<GlobalVariable>(
145144
M.getOrInsertGlobal(EmuTlsVarName, EmuTlsVarType));
146145
copyLinkageVisibility(M, GV, EmuTlsVar);
@@ -170,9 +169,7 @@ bool addEmuTlsVar(Module &M, const GlobalVariable *GV) {
170169
ConstantInt::get(WordType, DL.getTypeStoreSize(GVType)),
171170
ConstantInt::get(WordType, GVAlignment.value()), NullPtr,
172171
EmuTlsTmplVar ? EmuTlsTmplVar : NullPtr};
173-
ArrayRef<Constant*> ElementValueArray(ElementValues, 4);
174-
EmuTlsVar->setInitializer(
175-
ConstantStruct::get(EmuTlsVarType, ElementValueArray));
172+
EmuTlsVar->setInitializer(ConstantStruct::get(EmuTlsVarType, ElementValues));
176173
Align MaxAlignment =
177174
std::max(DL.getABITypeAlign(WordType), DL.getABITypeAlign(VoidPtrType));
178175
EmuTlsVar->setAlignment(MaxAlignment);

0 commit comments

Comments
 (0)