[PATCH] D15093: Fix the assert in Annotate the loop in SIAnnotateControlFlow pass when the loop terminator condition is a constant.

Changpeng Fang via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 09:15:17 PST 2015


cfang added inline comments.

================
Comment at: lib/Target/AMDGPU/SIAnnotateControlFlow.cpp:276-278
@@ +275,5 @@
+  // Insert IfBreak before TERM for constant COND.
+  } else if (isa<ConstantInt>(Cond)) {
+    Value *Args[] = { Cond, Broken };
+    return CallInst::Create(IfBreak, Args, "", Term);
+
----------------
tstellarAMD wrote:
> 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.
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. 


http://reviews.llvm.org/D15093





More information about the llvm-commits mailing list