[llvm-dev] Mips unconditionally uses fast-isel?

Daniel Sanders via llvm-dev
Tue, 17 Nov 2015 19:29:11 -0000

> > > I was mucking around in FastISel, and was surprised to see the
test
> > >   llvm/test/CodeGen/Mips/emergency-spill-slot-near-fp.ll
> > > failed.  This was surprising because it specifies
-fast-isel=false.
> > >
> > > Does the Mips code generator use fast-isel even when you ask it
not to?
> > > Thanks,
> > > --paulr
> >
> > This seems to be an all-targets bug. There's code in
OptLevelChanger
> > (lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp) that forces Fast ISel
to
> > be enabled for every -O0 function.
>
> Well.... the test specifies -O0 so even though the function is marked
> 'optnone' I'd expect OptLevelChanger to be a no-op, because it
checks
> whether the old and new OptLevel are the same. Which they should be.
>
> If I use -debug-only=isel I see it is changing from -O2 to -O0, which
> makes me think the "real" bug is that llc is ignoring -O0.
> --paulr

Looking further, I think it's a bit of both. Enabling Fast ISel when
-fast-isel=false is given doesn't make sense but there are also five targets
(Mips, BPF, Sparc, PPC, and AMDGPU) that use the SelectionDAGISel(TargetMachine
&) constructor which leave the optimization level at the default. The other
targets all pass on the optimization level using the two argument constructor.