Hold the molding against the wall where you know there is an irregularity.
Place a sharp pencil against the wall, perpendicular to the molding and with the point of the pencil to the edge of the molding.
Drag the pencil along the wall, allowing the point to leave a mark on the molding itself. The pencil will create a wavy line on the molding as opposed to a straight one when it hits an uneven spot on the wall. You can use this line to guide you when you trim the molding down to fit the wall.