How to prevent shader optimizations?

I was testing shader instruction performance, and to make results more clear i made a loop, and unrolled it.

[unroll] for(int j = 0; j < TEST_COUNT; j++)
{
	col = tex2D(_MainTex, i.uv.xy);					
}

But compiler optimized it and got rid of the whole loop, here ASM:

 8: mov o1.xyzw, v1.xyxy
 9: sample_l o2.xyzw, v1.xyxx, t0.xyzw, s0, v1.y
10: mov o3.xyzw, l(0.500000,0.500000,0.500000,0.500000)

So i did this:

[unroll] for(int j = 0; j < TEST_COUNT; j++)
{
	[isolate]
	{
		col = tex2D(_MainTex, i.uv.xy);			
	}
}

And compiler said: “unknown attribute isolate, or attribute invalid for this statement
Even if i add a little value to uv it doesn’t helps

Well, your code is pretty pointless in the loop as it doesn’t rely on the loop variable and it doesn’t apply any additive changes to a variable. So it’s obvious that this gets removed completely. You may want to have some code that actually need to be unrolled.

isolate seems to be HLSL only and only applies to XBox 360

What exactly do you want to achieve?