ilist::getPrevNode asserts on list head

Hi all,

I am finding a SEGFAULT in one of my passes when using getPrevNode on an
instruction that is the only one in a BasicBlock. I was expecting
getPrevNode to return 0 in that case (as per docs), but it breaks.

I guess the code in in ilist_node.h:

NodeTy *getPrevNode() {
  NodeTy *Prev = this->getPrev();

  // Check for sentinel.
  if (!Prev->getNext())
    return 0;

  return Prev;

would need to check if Prev is NULL before calling Prev->getNext().