llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Exponential expansion in IndVarSimplify/ScalarEvolutionExpander

Open uabjean opened this issue 9 years ago • 2 comments

Bugzilla Link 31543
Version trunk
OS Linux
Attachments reduced ll file that gives exponential expansion with opt
CC @hfinkel,@mikaelholmen

Extended Description

File size of output file and time taken by opt is an exponential function of a loop iteration count for the attached file:

opt -S -O1 -o foo.opt.ll foo.ll

alternatively, if -O1 is expanded and reduced:

opt -S -instcombine -loop-rotate -licm -instcombine -indvars -o foo.opt.ll foo.ll

It's IndVarSimplify::rewriteLoopExitValues() that calls ScalarEvolutionExpander to calculate loop exit value, but the expansion becomes exponential.

If I change the loop iteration count on this line:

%_tmp12 = icmp slt i16 %_tmp11, 6

The output ll file grows and compilation time lengthens exponentially. Some sample values:

bound file size of foo.opt.ll 6 4912 7 8944 8 17088 .. 15 2065266

uabjean avatar Jan 05 '17 12:01 uabjean

This issue does not reproduce anymore and it may have been solved late February somehow. Closing.

uabjean avatar Aug 15 '22 06:08 uabjean

@uabjean Thanks for following up on the issue and closing it!

fhahn avatar Aug 15 '22 07:08 fhahn