Hi! I've been playing with snippy, and found a situation where the register ra is used in a loop condition, but the initial value is clobbered by a successive function call. This leads to a situation where the specified number-of-loop-iterations is not taken into account which leads to loops with huge number of iterations.
The value of the ra register is set to 3 li ra, 3, but later it is clobbered by a function call jal ra, 2155f0 <fun25>. This makes the loop 0x213258 - 0x213260 iterate 0x213254 times instead of 3.
The issue is reproducible on the latest version from github: 35b9673a4c2ca61f301ff45a4fd85d16baf38c81
Snippy is invoked like that: ./bin/llvm-snippy -function-number=32 -function-layers=4 layout.yaml, the seed is: 1717939084212642052
Hi! I've been playing with snippy, and found a situation where the register
ra
is used in a loop condition, but the initial value is clobbered by a successive function call. This leads to a situation where the specifiednumber-of-loop-iterations
is not taken into account which leads to loops with huge number of iterations.Here is an example of incorrectly generated code:
The value of the
ra
register is set to 3li ra, 3
, but later it is clobbered by a function calljal ra, 2155f0 <fun25>
. This makes the loop0x213258 - 0x213260
iterate0x213254
times instead of 3.The issue is reproducible on the latest version from github: 35b9673a4c2ca61f301ff45a4fd85d16baf38c81
Snippy is invoked like that:
./bin/llvm-snippy -function-number=32 -function-layers=4 layout.yaml
, the seed is:1717939084212642052
Here is my layout.yaml: