If the condition is a constant, we insert a IfBreak intrinsic immediately before the Terminator.
This will fix the assert.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
The test is missing check lines, so FileCheck will error on it
test/CodeGen/AMDGPU/si-annotate-cfg-loop-assert.ll | ||
---|---|---|
1–2 ↗ | (On Diff #41431) | Isn't this fixing the test? Why is this xfailed? |
6–7 ↗ | (On Diff #41431) | These should be removed |
11 ↗ | (On Diff #41431) | Remove the align 2 |
15 ↗ | (On Diff #41431) | Can you run opt -strip -instnamer on this test? |
lib/Target/AMDGPU/SIAnnotateControlFlow.cpp | ||
---|---|---|
276–278 ↗ | (On Diff #41447) | 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 ↗ | (On Diff #41447) | 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 ↗ | (On Diff #41528) | 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 ↗ | (On Diff #41528) | It is true that the structrizer has a bug generating wrong constant condition. However, in a general sense, nothing prevents |