Re: [swift-dev] DebugScope Verification Error

2018-01-16 Thread Adrian Prantl via swift-dev
> On Jan 16, 2018, at 1:49 PM, Raj Barik wrote: > > Thanks a lot for the clarification Adrain and Vedant. > > What confused me is the cycle -- A SILFunction has a DeubgScope and the > DebugScope points back to the SILFunction. During moving instructions across > functions, one can easily m

Re: [swift-dev] DebugScope Verification Error

2018-01-16 Thread Raj Barik via swift-dev
Thanks a lot for the clarification Adrain and Vedant. What confused me is the cycle -- A SILFunction has a DeubgScope and the DebugScope points back to the SILFunction. During moving instructions across functions, one can easily mess up the pointers. As you all pointed out, one needs to also use

Re: [swift-dev] DebugScope Verification Error

2018-01-16 Thread Adrian Prantl via swift-dev
> On Jan 16, 2018, at 1:20 PM, Vedant Kumar wrote: > > + Adrian and Davide, since they work in this area. > > Hi Raj, > >> On Jan 15, 2018, at 4:48 PM, Raj Barik via swift-dev > > wrote: >> >> Thanks Mark. You are right, the following assertion fails >> >> requir

Re: [swift-dev] DebugScope Verification Error

2018-01-16 Thread Vedant Kumar via swift-dev
+ Adrian and Davide, since they work in this area. Hi Raj, > On Jan 15, 2018, at 4:48 PM, Raj Barik via swift-dev > wrote: > > Thanks Mark. You are right, the following assertion fails > > require(!DS || DS->getParentFunction() == I->getFunction(), > "debug scope of instruction be

Re: [swift-dev] DebugScope Verification Error

2018-01-15 Thread Raj Barik via swift-dev
Thanks Mark. You are right, the following assertion fails require(!DS || DS->getParentFunction() == I->getFunction(), "debug scope of instruction belongs to a different function"); I am not sure if we need such a check. On Mon, Jan 15, 2018 at 4:16 PM, Mark Lacey wrote: > > > On Ja

Re: [swift-dev] DebugScope Verification Error

2018-01-15 Thread Mark Lacey via swift-dev
> On Jan 15, 2018, at 12:54 PM, Raj Barik wrote: > > Mark, > > Thanks a lot for quick reply. > > Is there any reason this interface in SILInstruction should be private? > void setDebugScope(SILBuilder &B, const SILDebugScope *DS); > > In my case, I am splicing the old F into the new functio

Re: [swift-dev] DebugScope Verification Error

2018-01-15 Thread Raj Barik via swift-dev
Mark, Thanks a lot for quick reply. Is there any reason this interface in SILInstruction should be private? void setDebugScope(SILBuilder &B, const SILDebugScope *DS); In my case, I am splicing the old F into the new function NF. While splicing retains the debug scope, the new instruction (InitR

Re: [swift-dev] DebugScope Verification Error

2018-01-15 Thread Mark Lacey via swift-dev
I’d suggest looking at SILCloner.h as well as ScopeCloner in SILBasicBlock.cpp to see how they are dealing with debug scopes. Mark > On Jan 15, 2018, at 9:24 AM, Raj Barik via swift-dev > wrote: > > Hi, > > I am running into a debug scope SIL Verifier error when creating a new > function (N

[swift-dev] DebugScope Verification Error

2018-01-15 Thread Raj Barik via swift-dev
Hi, I am running into a debug scope SIL Verifier error when creating a new function (NF) from an existing one (F). Can someone point me where I am going wrong? NF = M.createFunction(, F->getDebugScope()); SILBasicBlock *NFBody = NF->createBasicBlock(); SILBuilder NFBuilder(NFBody); SILOpenedA