Fix handling of CHECK-DAG combined with CHECK-NOT

Patch by Daniel Sanders.