Skip to content

Commit

Permalink
[CodeGen] Avoid nullptr arg to CreateStructGEP (NFC)
Browse files Browse the repository at this point in the history
For now just make the getPointerElementType() explicit.
  • Loading branch information
nikic committed Jul 8, 2021
1 parent 9e225a2 commit a0ea367
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clang/lib/CodeGen/CGCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3437,7 +3437,8 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI,
--EI;
llvm::Value *ArgStruct = &*EI;
llvm::Value *SRet = Builder.CreateStructGEP(
nullptr, ArgStruct, RetAI.getInAllocaFieldIndex());
EI->getType()->getPointerElementType(), ArgStruct,
RetAI.getInAllocaFieldIndex());
llvm::Type *Ty =
cast<llvm::GetElementPtrInst>(SRet)->getResultElementType();
RV = Builder.CreateAlignedLoad(Ty, SRet, getPointerAlign(), "sret");
Expand Down

0 comments on commit a0ea367

Please sign in to comment.