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

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


----- Original Message -----
> From: "Tim Northover" <t.p.northover at gmail.com>
> To: "Sanjay Patel" <spatel at rotateright.com>
> Cc: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>
> Sent: Friday, May 23, 2014 2:22:55 PM
> Subject: Re: [LLVMdev] clang -O2 versus opt -O2 | llc | clang
> 
> Hi Sanjay,
> 
> > I'm investigating a miscompilation bug (
> > http://llvm.org/bugs/show_bug.cgi?id=19823 ), but I've run into a
> > problem:
> > the output of the program is different when I compile the IR with
> > clang
> > compared to opt | llc | clang. Any clues on how to resolve this
> > difference?
> 
> From the bug, it looks like there might be a problem with loop
> unrolling. Running "opt -loop-unroll -unroll-runtime" on its own
> performs the dodgy transformation and changes the output.
> 
> 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.

 -Hal

> 
> Cheers.
> 
> Tim.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 

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



More information about the llvm-dev mailing list