Mindwrack Demon's delirium triggered ability does not include an intervening "if" clause. This ability triggers at the beginning of your upkeep regardless of the number of types in your graveyard, and it checks that number as it resolves to determine whether you lose 4 life or not.