Skip to content

Commit fd05c34

Browse files
committed
Stop using legacy helpers indicating typed pointer types. NFC
Since we no longer support typed LLVM IR pointer types, the code can be simplified into for example using PointerType::get directly instead of using Type::getInt8PtrTy and Type::getInt32PtrTy etc. Differential Revision: https://reviews.llvm.org/D156733
1 parent f40af3b commit fd05c34

36 files changed

+176
-184
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10759,7 +10759,7 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
1075910759
CharUnits::fromQuantity(16));
1076010760
}
1076110761
case NEON::BI__builtin_neon_vstrq_p128: {
10762-
llvm::Type *Int128PTy = llvm::Type::getIntNPtrTy(getLLVMContext(), 128);
10762+
llvm::Type *Int128PTy = llvm::PointerType::getUnqual(getLLVMContext());
1076310763
Value *Ptr = Builder.CreateBitCast(Ops[0], Int128PTy);
1076410764
return Builder.CreateDefaultAlignedStore(EmitScalarExpr(E->getArg(1)), Ptr);
1076510765
}

clang/lib/CodeGen/CGObjCGNU.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4123,9 +4123,9 @@ llvm::GlobalVariable *CGObjCGNU::ObjCIvarOffsetVariable(
41234123
// when linked against code which isn't (most of the time).
41244124
llvm::GlobalVariable *IvarOffsetPointer = TheModule.getNamedGlobal(Name);
41254125
if (!IvarOffsetPointer)
4126-
IvarOffsetPointer = new llvm::GlobalVariable(TheModule,
4127-
llvm::Type::getInt32PtrTy(VMContext), false,
4128-
llvm::GlobalValue::ExternalLinkage, nullptr, Name);
4126+
IvarOffsetPointer = new llvm::GlobalVariable(
4127+
TheModule, llvm::PointerType::getUnqual(VMContext), false,
4128+
llvm::GlobalValue::ExternalLinkage, nullptr, Name);
41294129
return IvarOffsetPointer;
41304130
}
41314131

@@ -4169,10 +4169,11 @@ llvm::Value *CGObjCGNU::EmitIvarOffset(CodeGenFunction &CGF,
41694169
CGF.CGM.getTarget().getTriple().isKnownWindowsMSVCEnvironment())
41704170
return CGF.Builder.CreateZExtOrBitCast(
41714171
CGF.Builder.CreateAlignedLoad(
4172-
Int32Ty, CGF.Builder.CreateAlignedLoad(
4173-
llvm::Type::getInt32PtrTy(VMContext),
4174-
ObjCIvarOffsetVariable(Interface, Ivar),
4175-
CGF.getPointerAlign(), "ivar"),
4172+
Int32Ty,
4173+
CGF.Builder.CreateAlignedLoad(
4174+
llvm::PointerType::getUnqual(VMContext),
4175+
ObjCIvarOffsetVariable(Interface, Ivar),
4176+
CGF.getPointerAlign(), "ivar"),
41764177
CharUnits::fromQuantity(4)),
41774178
PtrDiffTy);
41784179
std::string name = "__objc_ivar_offset_value_" +

clang/lib/CodeGen/CGRecordLayoutBuilder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,9 @@ void CGRecordLowering::accumulateVPtrs() {
662662
llvm::FunctionType::get(getIntNType(32), /*isVarArg=*/true)->
663663
getPointerTo()->getPointerTo()));
664664
if (Layout.hasOwnVBPtr())
665-
Members.push_back(MemberInfo(Layout.getVBPtrOffset(), MemberInfo::VBPtr,
666-
llvm::Type::getInt32PtrTy(Types.getLLVMContext())));
665+
Members.push_back(
666+
MemberInfo(Layout.getVBPtrOffset(), MemberInfo::VBPtr,
667+
llvm::PointerType::getUnqual(Types.getLLVMContext())));
667668
}
668669

669670
void CGRecordLowering::accumulateVBases() {

clang/tools/clang-linker-wrapper/OffloadWrapper.cpp

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -368,21 +368,21 @@ GlobalVariable *createFatbinDesc(Module &M, ArrayRef<char> Image, bool IsHIP) {
368368
Function *createRegisterGlobalsFunction(Module &M, bool IsHIP) {
369369
LLVMContext &C = M.getContext();
370370
// Get the __cudaRegisterFunction function declaration.
371+
PointerType *Int8PtrTy = PointerType::get(C, 0);
372+
PointerType *Int8PtrPtrTy = PointerType::get(C, 0);
373+
PointerType *Int32PtrTy = PointerType::get(C, 0);
371374
auto *RegFuncTy = FunctionType::get(
372375
Type::getInt32Ty(C),
373-
{Type::getInt8PtrTy(C)->getPointerTo(), Type::getInt8PtrTy(C),
374-
Type::getInt8PtrTy(C), Type::getInt8PtrTy(C), Type::getInt32Ty(C),
375-
Type::getInt8PtrTy(C), Type::getInt8PtrTy(C), Type::getInt8PtrTy(C),
376-
Type::getInt8PtrTy(C), Type::getInt32PtrTy(C)},
376+
{Int8PtrPtrTy, Int8PtrTy, Int8PtrTy, Int8PtrTy, Type::getInt32Ty(C),
377+
Int8PtrTy, Int8PtrTy, Int8PtrTy, Int8PtrTy, Int32PtrTy},
377378
/*isVarArg*/ false);
378379
FunctionCallee RegFunc = M.getOrInsertFunction(
379380
IsHIP ? "__hipRegisterFunction" : "__cudaRegisterFunction", RegFuncTy);
380381

381382
// Get the __cudaRegisterVar function declaration.
382383
auto *RegVarTy = FunctionType::get(
383384
Type::getVoidTy(C),
384-
{Type::getInt8PtrTy(C)->getPointerTo(), Type::getInt8PtrTy(C),
385-
Type::getInt8PtrTy(C), Type::getInt8PtrTy(C), Type::getInt32Ty(C),
385+
{Int8PtrPtrTy, Int8PtrTy, Int8PtrTy, Int8PtrTy, Type::getInt32Ty(C),
386386
getSizeTTy(M), Type::getInt32Ty(C), Type::getInt32Ty(C)},
387387
/*isVarArg*/ false);
388388
FunctionCallee RegVar = M.getOrInsertFunction(
@@ -404,8 +404,7 @@ Function *createRegisterGlobalsFunction(Module &M, bool IsHIP) {
404404
: "__stop_cuda_offloading_entries");
405405
EntriesE->setVisibility(GlobalValue::HiddenVisibility);
406406

407-
auto *RegGlobalsTy = FunctionType::get(Type::getVoidTy(C),
408-
Type::getInt8PtrTy(C)->getPointerTo(),
407+
auto *RegGlobalsTy = FunctionType::get(Type::getVoidTy(C), Int8PtrPtrTy,
409408
/*isVarArg*/ false);
410409
auto *RegGlobalsFn =
411410
Function::Create(RegGlobalsTy, GlobalValue::InternalLinkage,
@@ -432,12 +431,12 @@ Function *createRegisterGlobalsFunction(Module &M, bool IsHIP) {
432431
Builder.CreateInBoundsGEP(getEntryTy(M), Entry,
433432
{ConstantInt::get(getSizeTTy(M), 0),
434433
ConstantInt::get(Type::getInt32Ty(C), 0)});
435-
auto *Addr = Builder.CreateLoad(Type::getInt8PtrTy(C), AddrPtr, "addr");
434+
auto *Addr = Builder.CreateLoad(Int8PtrTy, AddrPtr, "addr");
436435
auto *NamePtr =
437436
Builder.CreateInBoundsGEP(getEntryTy(M), Entry,
438437
{ConstantInt::get(getSizeTTy(M), 0),
439438
ConstantInt::get(Type::getInt32Ty(C), 1)});
440-
auto *Name = Builder.CreateLoad(Type::getInt8PtrTy(C), NamePtr, "name");
439+
auto *Name = Builder.CreateLoad(Int8PtrTy, NamePtr, "name");
441440
auto *SizePtr =
442441
Builder.CreateInBoundsGEP(getEntryTy(M), Entry,
443442
{ConstantInt::get(getSizeTTy(M), 0),
@@ -454,14 +453,13 @@ Function *createRegisterGlobalsFunction(Module &M, bool IsHIP) {
454453

455454
// Create kernel registration code.
456455
Builder.SetInsertPoint(IfThenBB);
457-
Builder.CreateCall(RegFunc,
458-
{RegGlobalsFn->arg_begin(), Addr, Name, Name,
459-
ConstantInt::get(Type::getInt32Ty(C), -1),
460-
ConstantPointerNull::get(Type::getInt8PtrTy(C)),
461-
ConstantPointerNull::get(Type::getInt8PtrTy(C)),
462-
ConstantPointerNull::get(Type::getInt8PtrTy(C)),
463-
ConstantPointerNull::get(Type::getInt8PtrTy(C)),
464-
ConstantPointerNull::get(Type::getInt32PtrTy(C))});
456+
Builder.CreateCall(RegFunc, {RegGlobalsFn->arg_begin(), Addr, Name, Name,
457+
ConstantInt::get(Type::getInt32Ty(C), -1),
458+
ConstantPointerNull::get(Int8PtrTy),
459+
ConstantPointerNull::get(Int8PtrTy),
460+
ConstantPointerNull::get(Int8PtrTy),
461+
ConstantPointerNull::get(Int8PtrTy),
462+
ConstantPointerNull::get(Int32PtrTy)});
465463
Builder.CreateBr(IfEndBB);
466464
Builder.SetInsertPoint(IfElseBB);
467465

clang/unittests/CodeGen/TBAAMetadataTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ TEST(TBAAMetadataTest, BasicTypes) {
113113

114114
I = matchNext(I,
115115
MInstruction(Instruction::Store,
116-
MValType(Type::getInt8PtrTy(Compiler.Context)),
116+
MValType(PointerType::getUnqual(Compiler.Context)),
117117
MMTuple(
118118
MMTuple(
119119
MMString("any pointer"),
@@ -125,7 +125,7 @@ TEST(TBAAMetadataTest, BasicTypes) {
125125

126126
I = matchNext(I,
127127
MInstruction(Instruction::Store,
128-
MValType(Type::getInt32PtrTy(Compiler.Context)),
128+
MValType(PointerType::getUnqual(Compiler.Context)),
129129
MMTuple(
130130
MMTuple(
131131
MMString("any pointer"),

llvm/include/llvm/Frontend/OpenMP/OMPKinds.def

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,29 @@
2626
#endif
2727

2828
#define __OMP_TYPE(VarName) OMP_TYPE(VarName, Type::get##VarName##Ty(Ctx))
29+
#define __OMP_PTR_TYPE(VarName) OMP_TYPE(VarName, PointerType::get(Ctx, 0))
2930

3031
__OMP_TYPE(Void)
3132
__OMP_TYPE(Int1)
3233
__OMP_TYPE(Int8)
3334
__OMP_TYPE(Int16)
3435
__OMP_TYPE(Int32)
3536
__OMP_TYPE(Int64)
36-
__OMP_TYPE(Int8Ptr)
37-
__OMP_TYPE(Int16Ptr)
38-
__OMP_TYPE(Int32Ptr)
39-
__OMP_TYPE(Int64Ptr)
37+
__OMP_PTR_TYPE(Int8Ptr)
38+
__OMP_PTR_TYPE(Int16Ptr)
39+
__OMP_PTR_TYPE(Int32Ptr)
40+
__OMP_PTR_TYPE(Int64Ptr)
4041
__OMP_TYPE(Double)
4142

4243
OMP_TYPE(SizeTy, M.getDataLayout().getIntPtrType(Ctx))
4344
OMP_TYPE(Int63, Type::getIntNTy(Ctx, 63))
4445

45-
#define __OMP_PTR_TYPE(NAME, BASE) OMP_TYPE(NAME, BASE->getPointerTo())
46+
__OMP_PTR_TYPE(VoidPtr)
47+
__OMP_PTR_TYPE(VoidPtrPtr)
48+
__OMP_PTR_TYPE(VoidPtrPtrPtr)
4649

47-
__OMP_PTR_TYPE(VoidPtr, Int8)
48-
__OMP_PTR_TYPE(VoidPtrPtr, VoidPtr)
49-
__OMP_PTR_TYPE(VoidPtrPtrPtr, VoidPtrPtr)
50-
51-
__OMP_PTR_TYPE(Int8PtrPtr, Int8Ptr)
52-
__OMP_PTR_TYPE(Int8PtrPtrPtr, Int8PtrPtr)
50+
__OMP_PTR_TYPE(Int8PtrPtr)
51+
__OMP_PTR_TYPE(Int8PtrPtrPtr)
5352

5453
#undef __OMP_PTR_TYPE
5554

llvm/include/llvm/IR/IRBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ class IRBuilderBase {
558558

559559
/// Fetch the type representing a pointer to an 8-bit integer value.
560560
PointerType *getInt8PtrTy(unsigned AddrSpace = 0) {
561-
return Type::getInt8PtrTy(Context, AddrSpace);
561+
return getPtrTy(AddrSpace);
562562
}
563563

564564
/// Fetch the type of an integer with size at least as big as that of a

llvm/lib/IR/Function.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,7 +1878,7 @@ void Function::allocHungoffUselist() {
18781878
setNumHungOffUseOperands(3);
18791879

18801880
// Initialize the uselist with placeholder operands to allow traversal.
1881-
auto *CPN = ConstantPointerNull::get(Type::getInt1PtrTy(getContext(), 0));
1881+
auto *CPN = ConstantPointerNull::get(PointerType::get(getContext(), 0));
18821882
Op<0>().set(CPN);
18831883
Op<1>().set(CPN);
18841884
Op<2>().set(CPN);
@@ -1890,8 +1890,7 @@ void Function::setHungoffOperand(Constant *C) {
18901890
allocHungoffUselist();
18911891
Op<Idx>().set(C);
18921892
} else if (getNumOperands()) {
1893-
Op<Idx>().set(
1894-
ConstantPointerNull::get(Type::getInt1PtrTy(getContext(), 0)));
1893+
Op<Idx>().set(ConstantPointerNull::get(PointerType::get(getContext(), 0)));
18951894
}
18961895
}
18971896

llvm/lib/Linker/IRMover.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ IRLinker::linkAppendingVarProto(GlobalVariable *DstGV,
937937
IsOldStructor = true;
938938
}
939939

940-
PointerType *VoidPtrTy = Type::getInt8Ty(SrcGV->getContext())->getPointerTo();
940+
PointerType *VoidPtrTy = PointerType::get(SrcGV->getContext(), 0);
941941
if (IsOldStructor) {
942942
auto &ST = *cast<StructType>(EltTy);
943943
Type *Tys[3] = {ST.getElementType(0), ST.getElementType(1), VoidPtrTy};

llvm/lib/Target/ARM/ARMFastISel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,7 +2180,7 @@ unsigned ARMFastISel::ARMSelectCallOp(bool UseReg) {
21802180

21812181
unsigned ARMFastISel::getLibcallReg(const Twine &Name) {
21822182
// Manually compute the global's type to avoid building it when unnecessary.
2183-
Type *GVTy = Type::getInt32PtrTy(*Context, /*AS=*/0);
2183+
Type *GVTy = PointerType::get(*Context, /*AS=*/0);
21842184
EVT LCREVT = TLI.getValueType(DL, GVTy);
21852185
if (!LCREVT.isSimple()) return 0;
21862186

@@ -2964,7 +2964,7 @@ unsigned ARMFastISel::ARMLowerPICELF(const GlobalValue *GV, MVT VT) {
29642964
/*AddCurrentAddress=*/UseGOT_PREL);
29652965

29662966
Align ConstAlign =
2967-
MF->getDataLayout().getPrefTypeAlign(Type::getInt32PtrTy(*Context));
2967+
MF->getDataLayout().getPrefTypeAlign(PointerType::get(*Context, 0));
29682968
unsigned Idx = MF->getConstantPool()->getConstantPoolIndex(CPV, ConstAlign);
29692969
MachineMemOperand *CPMMO =
29702970
MF->getMachineMemOperand(MachinePointerInfo::getConstantPool(*MF),

llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,10 @@ static Type *getAddrIntType(Module *M) {
471471
}
472472

473473
// Returns an integer pointer type for the target architecture's address space.
474-
// i32* for wasm32 and i64* for wasm64.
474+
// i32* for wasm32 and i64* for wasm64. With opaque pointers this is just a ptr
475+
// in address space zero.
475476
static Type *getAddrPtrType(Module *M) {
476-
return Type::getIntNPtrTy(M->getContext(),
477-
M->getDataLayout().getPointerSizeInBits());
477+
return PointerType::getUnqual(M->getContext());
478478
}
479479

480480
// Returns an integer whose type is the integer type for the target's address
@@ -495,7 +495,7 @@ WebAssemblyLowerEmscriptenEHSjLj::getFindMatchingCatch(Module &M,
495495
unsigned NumClauses) {
496496
if (FindMatchingCatches.count(NumClauses))
497497
return FindMatchingCatches[NumClauses];
498-
PointerType *Int8PtrTy = Type::getInt8PtrTy(M.getContext());
498+
PointerType *Int8PtrTy = PointerType::getUnqual(M.getContext());
499499
SmallVector<Type *, 16> Args(NumClauses, Int8PtrTy);
500500
FunctionType *FTy = FunctionType::get(Int8PtrTy, Args, false);
501501
Function *F = getEmscriptenFunction(
@@ -831,8 +831,7 @@ void WebAssemblyLowerEmscriptenEHSjLj::replaceLongjmpWith(Function *LongjmpF,
831831
Env =
832832
IRB.CreatePtrToInt(CI->getArgOperand(0), getAddrIntType(M), "env");
833833
else // WasmLongjmpF
834-
Env =
835-
IRB.CreateBitCast(CI->getArgOperand(0), IRB.getInt8PtrTy(), "env");
834+
Env = IRB.CreateBitCast(CI->getArgOperand(0), IRB.getPtrTy(), "env");
836835
IRB.CreateCall(NewF, {Env, CI->getArgOperand(1)});
837836
ToErase.push_back(CI);
838837
}
@@ -945,13 +944,13 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runOnModule(Module &M) {
945944
if (EnableEmEH) {
946945
// Register __resumeException function
947946
FunctionType *ResumeFTy =
948-
FunctionType::get(IRB.getVoidTy(), IRB.getInt8PtrTy(), false);
947+
FunctionType::get(IRB.getVoidTy(), IRB.getPtrTy(), false);
949948
ResumeF = getEmscriptenFunction(ResumeFTy, "__resumeException", &M);
950949
ResumeF->addFnAttr(Attribute::NoReturn);
951950

952951
// Register llvm_eh_typeid_for function
953952
FunctionType *EHTypeIDTy =
954-
FunctionType::get(IRB.getInt32Ty(), IRB.getInt8PtrTy(), false);
953+
FunctionType::get(IRB.getInt32Ty(), IRB.getPtrTy(), false);
955954
EHTypeIDF = getEmscriptenFunction(EHTypeIDTy, "llvm_eh_typeid_for", &M);
956955
}
957956

@@ -995,36 +994,36 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runOnModule(Module &M) {
995994
EmLongjmpF = getEmscriptenFunction(FTy, "emscripten_longjmp", &M);
996995
EmLongjmpF->addFnAttr(Attribute::NoReturn);
997996
} else { // EnableWasmSjLj
997+
Type *Int8PtrTy = IRB.getPtrTy();
998998
// Register __wasm_longjmp function, which calls __builtin_wasm_longjmp.
999999
FunctionType *FTy = FunctionType::get(
1000-
IRB.getVoidTy(), {IRB.getInt8PtrTy(), IRB.getInt32Ty()}, false);
1000+
IRB.getVoidTy(), {Int8PtrTy, IRB.getInt32Ty()}, false);
10011001
WasmLongjmpF = getEmscriptenFunction(FTy, "__wasm_longjmp", &M);
10021002
WasmLongjmpF->addFnAttr(Attribute::NoReturn);
10031003
}
10041004

10051005
if (SetjmpF) {
1006+
Type *Int8PtrTy = IRB.getPtrTy();
1007+
Type *Int32PtrTy = IRB.getPtrTy();
1008+
Type *Int32Ty = IRB.getInt32Ty();
10061009
// Register saveSetjmp function
10071010
FunctionType *SetjmpFTy = SetjmpF->getFunctionType();
1008-
FunctionType *FTy =
1009-
FunctionType::get(Type::getInt32PtrTy(C),
1010-
{SetjmpFTy->getParamType(0), IRB.getInt32Ty(),
1011-
Type::getInt32PtrTy(C), IRB.getInt32Ty()},
1012-
false);
1011+
FunctionType *FTy = FunctionType::get(
1012+
Int32PtrTy,
1013+
{SetjmpFTy->getParamType(0), Int32Ty, Int32PtrTy, Int32Ty}, false);
10131014
SaveSetjmpF = getEmscriptenFunction(FTy, "saveSetjmp", &M);
10141015

10151016
// Register testSetjmp function
1016-
FTy = FunctionType::get(
1017-
IRB.getInt32Ty(),
1018-
{getAddrIntType(&M), Type::getInt32PtrTy(C), IRB.getInt32Ty()},
1019-
false);
1017+
FTy = FunctionType::get(Int32Ty,
1018+
{getAddrIntType(&M), Int32PtrTy, Int32Ty}, false);
10201019
TestSetjmpF = getEmscriptenFunction(FTy, "testSetjmp", &M);
10211020

10221021
// wasm.catch() will be lowered down to wasm 'catch' instruction in
10231022
// instruction selection.
10241023
CatchF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_catch);
10251024
// Type for struct __WasmLongjmpArgs
1026-
LongjmpArgsTy = StructType::get(IRB.getInt8PtrTy(), // env
1027-
IRB.getInt32Ty() // val
1025+
LongjmpArgsTy = StructType::get(Int8PtrTy, // env
1026+
Int32Ty // val
10281027
);
10291028
}
10301029
}
@@ -1426,7 +1425,7 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runSjLjOnFunction(Function &F) {
14261425
// saveSetjmp and testSetjmp calls have the correct arguments.
14271426
SSAUpdater SetjmpTableSSA;
14281427
SSAUpdater SetjmpTableSizeSSA;
1429-
SetjmpTableSSA.Initialize(Type::getInt32PtrTy(C), "setjmpTable");
1428+
SetjmpTableSSA.Initialize(PointerType::get(C, 0), "setjmpTable");
14301429
SetjmpTableSizeSSA.Initialize(Type::getInt32Ty(C), "setjmpTableSize");
14311430
for (Instruction *I : SetjmpTableInsts)
14321431
SetjmpTableSSA.AddAvailableValue(I->getParent(), I);
@@ -1680,7 +1679,7 @@ void WebAssemblyLowerEmscriptenEHSjLj::handleLongjmpableCallsForWasmSjLj(
16801679
FunctionType::get(IRB.getInt32Ty(), /* isVarArg */ true);
16811680
Value *PersF = M.getOrInsertFunction(PersName, PersType).getCallee();
16821681
F.setPersonalityFn(
1683-
cast<Constant>(IRB.CreateBitCast(PersF, IRB.getInt8PtrTy())));
1682+
cast<Constant>(IRB.CreateBitCast(PersF, IRB.getPtrTy())));
16841683
}
16851684

16861685
// Use the entry BB's debugloc as a fallback
@@ -1733,7 +1732,7 @@ void WebAssemblyLowerEmscriptenEHSjLj::handleLongjmpableCallsForWasmSjLj(
17331732
Value *ValField =
17341733
IRB.CreateConstGEP2_32(LongjmpArgsTy, LongjmpArgs, 0, 1, "val_gep");
17351734
// void *env = __wasm_longjmp_args.env;
1736-
Instruction *Env = IRB.CreateLoad(IRB.getInt8PtrTy(), EnvField, "env");
1735+
Instruction *Env = IRB.CreateLoad(IRB.getPtrTy(), EnvField, "env");
17371736
// int val = __wasm_longjmp_args.val;
17381737
Instruction *Val = IRB.CreateLoad(IRB.getInt32Ty(), ValField, "val");
17391738

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18585,11 +18585,9 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const {
1858518585
// Get the Thread Pointer, which is %fs:__tls_array (32-bit) or
1858618586
// %gs:0x58 (64-bit). On MinGW, __tls_array is not available, so directly
1858718587
// use its literal value of 0x2C.
18588-
Value *Ptr = Constant::getNullValue(Subtarget.is64Bit()
18589-
? Type::getInt8PtrTy(*DAG.getContext(),
18590-
256)
18591-
: Type::getInt32PtrTy(*DAG.getContext(),
18592-
257));
18588+
Value *Ptr = Constant::getNullValue(
18589+
Subtarget.is64Bit() ? PointerType::get(*DAG.getContext(), 256)
18590+
: PointerType::get(*DAG.getContext(), 257));
1859318591

1859418592
SDValue TlsArray = Subtarget.is64Bit()
1859518593
? DAG.getIntPtrConstant(0x58, dl)

0 commit comments

Comments
 (0)