- 
                Notifications
    
You must be signed in to change notification settings  - Fork 15.1k
 
Closed
Labels
Description
Here in the code:
| if (numIteration > maxStage) { | 
llvm-project/mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
Lines 148 to 153 in 61529d9
| for (auto &opSchedule : schedule) { | |
| maxStage = std::max(maxStage, opSchedule.second); | |
| stages[opSchedule.first] = opSchedule.second; | |
| opOrder.push_back(opSchedule.first); | |
| } | |
maxStage is used before initialized.
When it checks numIteration > maxStage at line-127, maxStage is always 0 as default. So it will mistakenly decide if the loop trip count is actually greater than stage number, and thus pipelining a loop that should not have done.
At older llvm version(17), it was correct. The problem is introduced in this commit: ef11283