[LLVMbugs] [Bug 13468] New: Loop invariant code not hoisted

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 26 09:26:52 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13468

             Bug #: 13468
           Summary: Loop invariant code not hoisted
           Product: new-bugs
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: mike.gist at morganstanley.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Hi,

I would expect %15,%17,%18,%19 below to be moved to the entry block
I tried changing the branch from entry to loop to be conditional, in the hope
that it would allow the optimizers to hoist the invariant code out of the loop
in the case that the loop is executed, but that didn't have any impact.

Is this a case that the optimizer isn't dealing with, or have I missed
something ?

The code was optimized using 'opt -O3'.

define void @jitfn1(i64, i64, i8** nocapture, i8** nocapture) nounwind {
entry:
  %4 = load i8** %2
  %5 = bitcast i8* %4 to <8 x double>*
  %6 = getelementptr i8** %2, i64 1
  %7 = load i8** %6
  %8 = bitcast i8* %7 to double*
  %9 = getelementptr double* %8, i64 %0
  %10 = load i8** %3
  %11 = bitcast i8* %10 to <8 x double>*
  br label %loop

loop:                                             ; preds = %loop, %entry
  %12 = phi i64 [ 0, %entry ], [ %21, %loop ]
  %.sum = add i64 %12, %0
  %13 = getelementptr <8 x double>* %5, i64 %.sum
  %14 = load <8 x double>* %13
  %15 = load double* %9
  %16 = getelementptr <8 x double>* %11, i64 %.sum
  %17 = insertelement <1 x double> undef, double %15, i32 0
  %18 = shufflevector <1 x double> %17, <1 x double> undef, <8 x i32>
zeroinitializer
  %19 = fmul <8 x double> %18, <double 1.000000e-02, double 1.000000e-02,
double 1.000000e-02, double 1.000000e-02, double 1.000000e-02, double
1.000000e-02, double 1.000000e-02, double 1.000000e-02>
  %20 = fadd <8 x double> %14, %19
  store <8 x double> %20, <8 x double>* %16
  %21 = add i64 %12, 1
  %22 = icmp ult i64 %21, %1
  br i1 %22, label %loop, label %loop_exit

loop_exit:                                        ; preds = %loop
  ret void
}

-- 
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