[LLVMdev] clang -O2 versus opt -O2 | llc | clang

Hal Finkel hfinkel at anl.gov
Fri May 23 12:51:36 PDT 2014


----- Original Message -----
> From: "Tim Northover" <t.p.northover at gmail.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>, "Sanjay Patel" <spatel at rotateright.com>
> Sent: Friday, May 23, 2014 2:49:16 PM
> Subject: Re: [LLVMdev] clang -O2 versus opt -O2 | llc | clang
> 
> >> I've not tracked down quite how Clang sets that extra
> >> "-unroll-runtime" option (I'd be interested to know myself,
> >> actually,
> >> having failed).
> >
> > It doesn't, but the backend can by overriding
> > TTI::getUnrollingPreferences
> > or setting LoopMicroOpBufferSize in the processor scheduling model.
> 
> I don't think that explains what I'm seeing either: only PPC and R600
> seem to mention that function. All code I'm compiling is x86_64.

You missed my "or" :-) -- The x86_64 processor models (for Haswell, Sandy Bridge, etc.) do set LoopMicroOpBufferSize and will runtime unroll small loops.

 -Hal

> 
> Cheers.
> 
> Tim.
> 
> (Incidentally, "opt -loop-unroll -unroll-runtime" may need an already
> optimised .ll file. I'm attaching my copy here in case it helps
> anyone).
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list