[LLVMdev] Suspicious code in backend scheduler

Evan Cheng evan.cheng at apple.com
Mon Aug 9 19:24:50 PDT 2010


Thanks for the report. It's been getting lucky. I'll fix it.

Evan

On Aug 8, 2010, at 6:27 AM, Amaury Pouly wrote:

> Hello,
> Still trying to write a custom scheduler, I stumbled accross a highly suspicious code in all schedulers.
> In both ScheduleDAGFast.cpp and ScheduleDAGRRList.cpp, one can find this piece of code:
> 
> SUnit *CopyFromSU = CreateNewSUnit(NULL);
> 
> and then in the same files:
> 
> SUnit *CreateNewSUnit(SDNode *N) {
>     [...]
>     SUnit *NewNode = NewSUnit(N);
> 
> And finally in ScheduleDAGSDNodes.cpp:
> 
> SUnit *ScheduleDAGSDNodes::NewSUnit(SDNode *N) {
>   [...]
>   if (N->isMachineOpcode() && [...]
> 
> So basically, it means that calling CreateNewSUnit with NULL will call NewSUnit with NULL and with result in NULL->isMachineOpcode() which would certainly trigger a segfault.
> Now I'm highly surprized because I still haven't encountered any segfault in the scheduler yet all schedulers might call this code.
> So either I'm missing something and this code is valid or this code has not been executed for a *really* long time now and should be removed or fixed. Unfortunately, I don't know the code enough to fix it if it's necessary that's why I'm seeking for help or reviews on this point :)
> 
> Regards
> 
> Amaury Pouly
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list