Skip to content

Commit b4f17d8

Browse files
committed
[CHERI] Fix uses of deprecated withPointerElemTy() API
Also drop some unused DefaultAS variables that are no longer needed due to upstream opaque pointer changes.
1 parent c6af0fa commit b4f17d8

File tree

5 files changed

+8
-25
lines changed

5 files changed

+8
-25
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2389,7 +2389,6 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
23892389
return RValue::get(llvm::ConstantFP::get(getLLVMContext(),
23902390
Result.Val.getFloat()));
23912391
}
2392-
unsigned DefaultAS = CGM.getTargetCodeGenInfo().getDefaultAS();
23932392

23942393
// If current long-double semantics is IEEE 128-bit, replace math builtins
23952394
// of long-double with f128 equivalent.

clang/lib/CodeGen/CGException.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,9 @@ void CodeGenFunction::EnterCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) {
638638
TypeInfo.RTTI = CGM.getObjCRuntime().GetEHType(CaughtType);
639639
TypeInfo.RTTI = llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
640640
TypeInfo.RTTI,
641-
llvm::PointerType::getWithSamePointeeType(
642-
cast<llvm::PointerType>(TypeInfo.RTTI->getType()), 0));
641+
llvm::PointerType::get(
642+
cast<llvm::PointerType>(TypeInfo.RTTI->getType())->getContext(),
643+
0));
643644
} else
644645
TypeInfo = CGM.getCXXABI().getAddrOfCXXCatchHandlerType(
645646
CaughtType, C->getCaughtType());

clang/lib/CodeGen/CGObjCGNU.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2636,7 +2636,7 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGenFunction &CGF,
26362636
llvm::Value *imp = LookupIMPSuper(CGF, ObjCSuper, cmd, MSI);
26372637
if (AS != 0)
26382638
MSI.MessengerType =
2639-
llvm::PointerType::getWithSamePointeeType(MSI.MessengerType, AS);
2639+
llvm::PointerType::get(MSI.MessengerType->getContext(), AS);
26402640
imp = EnforceType(Builder, imp, MSI.MessengerType);
26412641

26422642
llvm::Metadata *impMD[] = {
@@ -2823,7 +2823,7 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
28232823
// of the pointer, or we will end up deriving a DDC-relative capability,
28242824
// which won't have the execute permission.
28252825
MSI.MessengerType =
2826-
llvm::PointerType::getWithSamePointeeType(MSI.MessengerType, 0);
2826+
llvm::PointerType::get(MSI.MessengerType->getContext(), 0);
28272827
}
28282828

28292829
// Reset the receiver in case the lookup modified it
@@ -3882,7 +3882,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
38823882
llvm::Constant *module = [&] {
38833883
llvm::Type *moduleEltTys[] = {
38843884
LongTy, LongTy, PtrToInt8Ty,
3885-
llvm::PointerType::getWithSamePointeeType(symtabTy, AS), IntTy};
3885+
llvm::PointerType::get(symtabTy->getContext(), AS), IntTy};
38863886
llvm::StructType *moduleTy =
38873887
llvm::StructType::get(CGM.getLLVMContext(),
38883888
ArrayRef(moduleEltTys).drop_back(unsigned(RuntimeVersion < 10)));
@@ -3935,8 +3935,8 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
39353935

39363936
llvm::PointerType *moduleTy = cast<llvm::PointerType>(module->getType());
39373937
llvm::FunctionType *FT = llvm::FunctionType::get(
3938-
Builder.getVoidTy(),
3939-
llvm::PointerType::getWithSamePointeeType(moduleTy, AS), true);
3938+
Builder.getVoidTy(), llvm::PointerType::get(moduleTy->getContext(), AS),
3939+
true);
39403940
llvm::FunctionCallee Register =
39413941
CGM.CreateRuntimeFunction(FT, "__objc_exec_class");
39423942
Builder.CreateCall(Register, module);

clang/lib/CodeGen/ItaniumCXXABI.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,6 @@ ItaniumCXXABI::GetVirtualBaseClassOffset(CodeGenFunction &CGF, Address This,
17061706
"vbase.offset.ptr");
17071707

17081708
llvm::Value *VBaseOffset;
1709-
unsigned DefaultAS = CGM.getTargetCodeGenInfo().getDefaultAS();
17101709
bool IsPurecap =
17111710
CGF.getContext().getTargetInfo().areAllPointersCapabilities();
17121711
if (CGM.getItaniumVTableContext().isRelativeLayout()) {
@@ -2247,7 +2246,6 @@ static llvm::Value *performTypeAdjustment(CodeGenFunction &CGF,
22472246
llvm::Value *VTablePtr = CGF.Builder.CreateLoad(VTablePtrPtr);
22482247

22492248
llvm::Value *Offset;
2250-
unsigned AS = CGF.CGM.getDataLayout().getGlobalsAddressSpace();
22512249
llvm::Value *OffsetPtr = CGF.Builder.CreateConstInBoundsGEP1_64(
22522250
CGF.Int8Ty, VTablePtr, VirtualAdjustment);
22532251
if (CGF.CGM.getItaniumVTableContext().isRelativeLayout()) {

llvm/lib/CodeGen/CheriBoundAllocas.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -294,21 +294,6 @@ class CheriBoundAllocas : public ModulePass, public InstVisitor<CheriBoundAlloca
294294
// Instead of cloning the alloca, mutate it in-place to avoid missing
295295
// some important metadata (debug info/attributes/etc.).
296296
AI->setAllocatedType(TypeWithPadding);
297-
if (!AI->getType()->isOpaquePointerTy()) {
298-
// Explicitly create a bitcast instruction to allow us to RAUW all
299-
// uses after changing the type (not needed with opaque pointers).
300-
// We have to use a NULL source temporarily since we can only use
301-
// AI after calling AI->mutateType(), and RAUW will assert if
302-
// called after AI->mutateType(), so we need this temporary.
303-
auto *NewPtr = new BitCastInst(
304-
ConstantPointerNull::get(AllocaPtrTy), AllocaPtrTy,
305-
"without-tail-padding", AI->getNextNonDebugInstruction());
306-
AI->replaceAllUsesWith(NewPtr);
307-
AI->mutateType(
308-
TypeWithPadding->getPointerTo(AI->getAddressSpace()));
309-
// Finally, set bitcast source to AI
310-
NewPtr->getOperandUse(0).set(AI);
311-
}
312297
Size = ConstantInt::get(
313298
SizeTy, AllocaSize + static_cast<uint64_t>(TailPadding));
314299
}

0 commit comments

Comments
 (0)