Imagine you render scene with vsync turned on.
If you go with 'if' implementation, you will process single input event per rendered frame.
But there will be lots of events, especially when mouse moves. If you will process only one event, render frame, wait for 16ms (vsync on), then with simple mouse movement you will create some work for many seconds upfront. Scene update will lag to the point where app will become totally unresponsive.
So you must go with 'while' loop, processing all inputs before you start rendering.
With 'while' it sounds like waiting till a message occurs.
You don't wait for events with PeekMessage(), you would wait with GetMessage().
The if version won't run any update or rendering logic unless peekmessage returns false so it should work properly.
All game and rendering code is inside the else block, it should even be a tiny bit faster since it only has to do the check for VM_QUIT (and not the extra assignment and checks for run like the while version does)
It also has the advantage of exiting almost immediately on a VM_QUIT, the while version will run through one update before exiting.