[llvm-dev] [RFC] Setting the current debug loc when the insertion point changes

Vedant Kumar via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 9 10:54:26 PST 2017


> On Nov 8, 2017, at 9:29 AM, Tobias Edler von Koch <tobias at codeaurora.org> wrote:
> 
> There's also the opposite problem of the IRBuilder sometimes not being able to find a debug location at the insertion point when it is required to add one (e.g. when inserting a CallInst into a function that has debug info)... another argument for making it explicit!

Right. It's not too onerous to type "setInsertPoint(..., DebugLoc())" if the location really is unknown, and it's a lot more explicit.


> On 11/06/2017 05:32 PM, Vedant Kumar via llvm-dev wrote:
>> Wdyt of adopting parts of both solutions? I.e, we'd have the following methods:
>> 
>> // Transition API
>> - SetInsertPointAndDebugLoc(BasicBlock *)
>> - SetInsertPointAndDebugLoc(Instruction *)
>> - SetInsertPointAndDebugLoc(BasicBlock *, BasicBlock::iterator)
>> 
>> // Future API
>> - SetInsertPoint(BasicBlock *, const DebugLoc &)
>> - SetInsertPoint(Instruction *, const DebugLoc &)
>> - SetInsertPoint(BasicBlock *, BasicBlock::iterator, const DebugLoc &)
> 
> +1 to this solution. We shouldn't silently change the behavior of the existing SetInsertPoint API.

Good to hear. I think it would be even simpler if we skip renaming the existing users, and just added the future APIs. I'll send out a patch.

thanks,
vedant

> 
> Thanks,
> Tobias
> 
> -- 
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project.
> 



More information about the llvm-dev mailing list