If the condition is a constant, we insert a IfBreak intrinsic immediately before the Terminator.
This will fix the assert.
Details
Diff Detail
Event Timeline
lib/Target/AMDGPU/SIAnnotateControlFlow.cpp | ||
---|---|---|
276–278 | Usually getting a branch on constant in the SIAnnotateControlFlow means that there is a bug in the StructurizeCFG pass. |
lib/Target/AMDGPU/SIAnnotateControlFlow.cpp | ||
---|---|---|
276–278 | Why do you think there is a bug in the structurizer? My understanding is that, for an infinite loop or a one-trip (do-while) loop, the condition can be a constant, even though we may be able to optimize away the loop for the later case. |
lib/Target/AMDGPU/SIAnnotateControlFlow.cpp | ||
---|---|---|
276–278 | This kind of failure is a common symptom of strurcturizer bugs. You should run llc with -print-before-all to see if the constant branch exists before the structurizer is run. |
Any further comment?
lib/Target/AMDGPU/SIAnnotateControlFlow.cpp | ||
---|---|---|
276–278 | It is true that the structrizer has a bug generating wrong constant condition. However, in a general sense, nothing prevents |
Usually getting a branch on constant in the SIAnnotateControlFlow means that there is a bug in the StructurizeCFG pass.
There is no harm in handling this here, but I think it may just be covering over a bug in the structurizer pass.