Loop Merging - Exit Condition - 2022.1 English

Vitis HLS Messaging (UG1448)

Document ID
UG1448
Release Date
2022-06-22
Version
2022.1 English

Description

This message reportsthat the code is violating loop merging optimization rules.

Explanation

Loop merging optimization requires the loops to not have multiple exit conditions, as shown in the following code:

void example_label(int A[50], int B[50]) {
  int i=0;
#pragma HLS loop_merge force
  do{
 
     B[i] = A[i] + 5;
     if(B[i]==A[i]*B[i])
     {
         break;
     }
     else if (B[i] == A[i]+B[i])
     {
         break;
     }
  i++;
  }while(i<50);
 i=0;
  do{
  B[i] = A[i] + 5;
  i++;
  }while(i<50);

Solution

Make sure there is only one exit condition among the loops.