[LLVMbugs] [Bug 11034] New: LLVM failed at deleting my loops

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 28 15:57:47 PDT 2011


           Summary: LLVM failed at deleting my loops
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
        AssignedTo: nlewycky at google.com
        ReportedBy: chandlerc at gmail.com
                CC: llvmbugs at cs.uiuc.edu

I was hacking on something totally different, and went to show the *obviously*
trivial code to Nick. And LLVM didn't delete it. WTF.

; ModuleID = 'arr1.cc'
target datalayout =
target triple = "x86_64-unknown-linux-gnu"

%struct.X = type { [27 x i8], [2 x i8] }

@_ZZ5testXiiPcE1x = private unnamed_addr constant %struct.X { [27 x i8]
[2 x i8] c"a\00" }, align 1

define i32 @_Z5testXiiPc(i32 %i, i32 %j, i8* nocapture %c) nounwind uwtable
readnone {
  br label %for.body

for.body:                                         ; preds = %for.body, %entry
  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
  %sum.02 = phi i32 [ 0, %entry ], [ %add, %for.body ]
  %arrayidx = getelementptr inbounds %struct.X* @_ZZ5testXiiPcE1x, i64 0, i32
0, i64 %indvars.iv
  %0 = load i8* %arrayidx, align 1, !tbaa !0
  %conv = sext i8 %0 to i32
  %add = add nsw i32 %conv, %sum.02
  %indvars.iv.next = add i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond = icmp eq i32 %lftr.wideiv, 27
  br i1 %exitcond, label %for.end, label %for.body

for.end:                                          ; preds = %for.body
  ret i32 %add

!0 = metadata !{metadata !"omnipotent char", metadata !1}
!1 = metadata !{metadata !"Simple C/C++ TBAA", null}

Why is there a loop body here? The result is statically known....

My favorite part: if you make the array size 18, it works. But 19 or higher,
and it gives up. =[

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