Trip Count and Redundant Loops
Trip count is minimum number of times a loop executes
- Must be a constant
- Used in software pipelining by assembler optimizer if loop counts down
- Compiler can transform some loops to count down
- If compiler cannot determine that a loop will always execute for the minimum trip count, then it generates a redundant unpipelined loop
Communicating trip count information in C
- Use -o3 and -pm compiler options
- Use _nassert intrinsic
_nassert(N >= 10);