Skip to content

[SUA] Set debug location when creating a call to frame allocator in emitAlloc #10239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,8 @@ static Instruction *lowerNonLocalAlloca(CoroAllocaAllocInst *AI,
coro::Shape &Shape,
SmallVectorImpl<Instruction*> &DeadInsts) {
IRBuilder<> Builder(AI);
auto Alloc = Shape.emitAlloc(Builder, AI->getSize(), nullptr);
auto Alloc = Shape.emitAlloc(Builder, AI->getSize(), nullptr,
AI->getDebugLoc());

for (User *U : AI->users()) {
if (isa<CoroAllocaGetInst>(U)) {
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Transforms/Coroutines/CoroInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ struct LLVM_LIBRARY_VISIBILITY Shape {
/// Allocate memory according to the rules of the active lowering.
///
/// \param CG - if non-null, will be updated for the new call
Value *emitAlloc(IRBuilder<> &Builder, Value *Size, CallGraph *CG) const;
Value *emitAlloc(IRBuilder<> &Builder, Value *Size, CallGraph *CG,
const DebugLoc DbgLoc=nullptr) const;

/// Deallocate memory according to the rules of the active lowering.
///
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Transforms/Coroutines/CoroSplit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1886,7 +1886,8 @@ static void splitRetconCoroutine(Function &F, coro::Shape &Shape,
// Allocate. We don't need to update the call graph node because we're
// going to recompute it from scratch after splitting.
// FIXME: pass the required alignment
RawFramePtr = Shape.emitAlloc(Builder, Builder.getInt64(Size), nullptr);
RawFramePtr = Shape.emitAlloc(Builder, Builder.getInt64(Size), nullptr,
Id->getDebugLoc());
RawFramePtr =
Builder.CreateBitCast(RawFramePtr, Shape.CoroBegin->getType());

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Transforms/Coroutines/Coroutines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ static void addCallToCallGraph(CallGraph *CG, CallInst *Call, Function *Callee){
}

Value *coro::Shape::emitAlloc(IRBuilder<> &Builder, Value *Size,
CallGraph *CG) const {
CallGraph *CG, const DebugLoc DbgLoc) const {
unsigned sizeParamIndex = UINT_MAX;
switch (ABI) {
case coro::ABI::Switch:
Expand Down Expand Up @@ -512,6 +512,7 @@ Value *coro::Shape::emitAlloc(IRBuilder<> &Builder, Value *Size,
Args.push_back(TypeId);
}
auto *Call = Builder.CreateCall(Alloc, Args);
Call->setDebugLoc(DbgLoc);
propagateCallAttrsFromCallee(Call, Alloc);
addCallToCallGraph(CG, Call, Alloc);
return Call;
Expand Down