Why not clear xYieldPending to 0 at the beginning of xTaskResumeAll?

When xTaskResumeAll is called, it check pending list and pending ticks. Why is the xYieldPendings not cleared before checking. I encounter one scenario like below. The context switch in xTaskResumeAll seems redundant. So I doubt if I can clear xYieldPendings at the beginning of xTaskResumeAll?

Task A called xTaskSuspendAll → IRQ triggered →IRQ call xTaskSwitchContext (xYieldPendings is et to TRUE) and return to Task A → Task A calls xTaskResumeAll →Yield is called and do context switch → Back to Task A

Which IRQ is this? Why did this call switch context?

That is not always true. If IRQ unblocks a high priority task, you’ll return to that task.

I don’t mean to call xTaskSwitchContext in IRQ handler. When IRQ handler is finish, xTaskSwitchContext is called to pick up highest task to return.

We are trying to reduce CPU active time to save power. When IRQ is finished, and not task ready (except idle task), the best case is returning to idle task and then back to sleep again.

This should only be done if a higher priority task was woken up by the IRQ handler. Are you always doing that? Can you share your IRQ handler code?