If a plant has bitter-tasting leaves, this would most likely protect the plant against:
D. caterpillars that would eat the plant.
The bitterness serves as a deterrent to herbivores, including caterpillars, making the plant less appealing as a food source.