[LLVMbugs] [Bug 13050] New: nested loops leave dead loop for degenerate case
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jun 7 14:07:40 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13050
Bug #: 13050
Summary: nested loops leave dead loop for degenerate case
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Loop Optimizer
AssignedTo: unassignedbugs at nondot.org
ReportedBy: hfinkel at anl.gov
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
/test-suite/SingleSource/Regression/C/sumarray2d.c contains the function:
int SumArray(int Array[][100], unsigned int NumI, unsigned int NumJ) {
unsigned i, j;
int Result = 0;
for (i = 0; i < NumI; i++)
for (j = 0; j < NumJ; j++)
Result += Array[i][j];
return Result;
}
compiling this with clang -O3 produces:
define i32 @SumArray([100 x i32]* nocapture %Array, i32 %NumI, i32 %NumJ)
nounwind uwtable readonly {
entry:
%cmp12 = icmp eq i32 %NumI, 0
br i1 %cmp12, label %for.end8, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%cmp29 = icmp eq i32 %NumJ, 0
br i1 %cmp29, label %for.inc6, label %for.body3.lr.ph.us
... (regular loop processing) ...
for.inc6: ; preds = %for.inc6,
%for.cond1.preheader.lr.ph
%i.013 = phi i32 [ %inc7, %for.inc6 ], [ 0, %for.cond1.preheader.lr.ph ]
%inc7 = add i32 %i.013, 1
%exitcond20 = icmp eq i32 %inc7, %NumI
br i1 %exitcond20, label %for.end8, label %for.inc6
... (end block)
I don't see any reason for the %for.inc6 loop to exists, it does not seem to
have any effect. Nothing in CodeGen eliminates it, and so it ends up in the
executable.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list