Hang in InstCombiner::DoOneIteration

Hi,

I'm hoping someone here can help me.

I've just updated to LLVM 3.5.0 and when I run the following I eventually get a crash when I run out of memory.

opt -O2 bug.ll

I'll try 3.5.1, then if that's still fails I'll try trunk.

It seems to be related to the
  %5 = fptrunc double %4 to float
line which is continually being added to the work list.

Rob.

bug.ll contains the following:

; ModuleID = 'bug.u'
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
target triple = "i686-pc-windows-msvc"

%string = type { i8*, i8* }
%vec3 = type { float, float, float }
%var = type { i32, i64 }

%object = type { i8*, %string, %string, i8* }

@hue = global double 0.000000e+00

; Function Attrs: noinline nounwind
declare double @rand__d__v() #0

; Function Attrs: noinline nounwind
declare %vec3* @vec3__PZ4vec3__fff(float, float, float) #0

; Function Attrs: noinline nounwind
define i32 @main__i__v() #0 {
locals:
  br label %entry

entry: ; preds = %locals

  %0 = call double @rand__d__v() #1
  store double %0, double* @hue

  %1 = load double* @hue
  %2 = fadd double %1, 0x3FE3C6EF372FE951
  store double %2, double* @hue

  %3 = load double* @hue
  %4 = frem double %3, 1.000000e+00
  %5 = fptrunc double %4 to float
  %6 = call %vec3* @vec3__PZ4vec3__fff(float %5, float 0x3FD3333340000000, float 0x3FEE666660000000) #1

  ret i32 0
}

attributes #0 = { noinline nounwind }
attributes #1 = { nounwind }

The last few lines from the log are as follows:

[2015-02-12 16:48:08.678188100] 0xb81c40 Executing Pass 'Interprocedural Sparse Conditional Constant Propagation' on Module 'bug.ll'...
0xb94e90 Required Analyses: Target Library Information
-*- 'Interprocedural Sparse Conditional Constant Propagation' is the last user of following pass instances. Free theseinstances
[2015-02-12 16:48:08.683191600] 0xb81c40 Freeing Pass 'Interprocedural Sparse Conditional Constant Propagation' on Module 'bug.ll'...
[2015-02-12 16:48:08.686193300] 0xb81c40 Executing Pass 'Global Variable Optimizer' on Module 'bug.ll'...
0xb845b0 Required Analyses: Target Library Information
-*- 'Global Variable Optimizer' is the last user of following pass instances. Free these instances
[2015-02-12 16:48:08.688194100] 0xb81c40 Freeing Pass 'Global Variable Optimizer' on Module 'bug.ll'...
[2015-02-12 16:48:08.690195800] 0xb81c40 Executing Pass 'Dead Argument Elimination' on Module 'bug.ll'...
-*- 'Dead Argument Elimination' is the last user of following pass instances. Free these instances
[2015-02-12 16:48:08.694198400] 0xb81c40 Freeing Pass 'Dead Argument Elimination' on Module 'bug.ll'...
[2015-02-12 16:48:08.696202400] 0xb81c40 Executing Pass 'Function Pass Manager' on Module 'bug.ll'...
[2015-02-12 16:48:08.698201000] 0xba8638 Executing Pass 'Combine redundant instructions' on Function 'main__i__v'...
0xbb0fc8 Required Analyses: Target Library Information

bug.ll (1.05 KB)

Hi Rob,

I’m pretty sure this was r222040, r222265, and r224097.

I’d try trunk.