Does a truck stop faster if the stack on the back of truck is stable or if it moves forward? My question in the title might not be very descriptive so I am re-writing it here:
If there is a truck in motion and it has stack of hay (lets suppose) on the back. Now if the truck comes to a sudden stop will it stop faster if the force exerted by the truck on hay had overcome the friction force (another wording: will it be faster if the hay slips forward) or will it stop faster if the hay remains constant.
EDIT:
I do not know where everyone is getting tied down option or not. The hay isn't tied down (sorry for misguiding). There are two situations, it slides on the trucks back or it doesn't slide on trucks back. And in which situation does the truck stop faster?
 A: This is the simplest analogy I could think of.
Imagine a long narrow carpet sliding across a huge ice rink at 1kph. On the rear end of the carpet stands a very fat (200kg) man wearing roller skates. You want to 
bring him to a standstill. You could grab the man and dig your ice skates into the ice until he eventually stops. Alternatively, you could grab the back edge of the carpet.
The carpet essentially weighs nothing so you stop it easily. On the other hand, the fat man will start a comedy journey along the carpet,
gradually slowing down as he goes along and eventually rolls to a stop.
In other words, some of the energy of the moving fat man has been lost in friction between his skates and the carpet, not by friction between 
your skates and the ice.
In your original truck scenario, the load slides forward dissipating some of its kinetic energy as heat as it goes. If it hits the front of the
trailer, some of the remaining energy will be transferred back into forward motion of the truck - but hopefully, by that time, the truck will have
reached a standstill anyway and will have plenty of spare braking capacity.
A: 
...a truck in motion and it has stack of hay (lets suppose) on the back.
  Now if the truck comes to a sudden stop will it stop faster if the
  force exerted by the truck on hay had overcome the friction force
  (another wording: will it be faster if the hay slips forward) or will
  it stop faster if the hay remains constant.

I tried to find a braking vehicle that would produce the situation described in the answers: a truck

or a semitrailer

but I couldn't.
Unless the hay is thrown out of the truck, I believe there can't be any difference because even if the hay slips forward, it will allways hit one side of the truck and be eventually stopped by the brakes, isn't that so?
Wanting to be more precise: it will take only a fraction of a second and the cargo will be secured by the bodywork of the truck and it will be stopping anyway truck+hay (plus an infinitesimal amount of energy turned into heat).
A: On the whole, static friction is higher than dynamic friction. This means that if you can brake without your wheels skidding, you will come to a halt more quickly. So let's assume that the truck brakes without skidding, and see where that gets us.
Let's assume that your truck has weight $W = Mg$ with a haystack with additional weight $w = mg$ on top. Coefficient of (static) friction between wheels and road is $\mu_1$, and friction between haystack and truck bed is $\mu_2$.
The normal force on the tires is $W+w$ and the maximum static friction is $\mu_1(W+w)$. 
If the wheels stop in a distance $D$ and the hay stack can slide an additional distance $d$ on the truck bed, then the work done to bring the entire assembly to a halt (which must be equal to the kinetic energy we started with) is
$$\mu_1 (W+w) D + \mu_2 w d$$
If there was no movement of the haystack, $d=0$ and the second term would disappear.
So if we have to do the same amount of work to bring the truck to a halt in both cases, we can set the distance of the no-slide truck to $D'$ and we get the expression:
$$\mu_1 (W+w) D + \mu_2 w d = \mu_1(W+w) D'\\
D' = D + \frac{\mu_2 w }{\mu_1(W+w)}d$$
Since the second term is always greater than zero, the stopping distance will be longer for the truck that has the hay stack tied down (or otherwise not sliding).
A: Not to detract from Floris' answer, but I think this is an instance where it is nice to think in terms of limits.
If the hay is tied down, you're stopping an object with mass (truck + hay).
If the hay isn't tied down, but on a sufficiently sticky surface such that it doesn't move, it should be the same as stopping it if it were fixed, since the outcome is the same.
In the other extreme, if the coefficient of friction between the hay and the truck was zero, we wouldn't care about the hay at all, except that now you are just stopping a truck of mass (truck), with a normal force of (truck + hay), which will stop sooner.
The in between cases will be in between.
