Closed GoogleCodeExporter closed 9 years ago
Copied from the previous issue 42:
The biggest wins from embedding consts directly would come from letting
LLVM's const-propagation passes work over them. For example, if we see the code
"1+a", we currently turn that into an indirect call to
"1"->ob_type->tp_as_number->nb_add(1, a). Exposing the whole definition of "1"
to
LLVM would let it inline that to the direct call int_add(1, a). We'll have to
clang-compile quite a bit more before it can actually do that, but the
LOAD_CONST
improvement should be a step toward that.
The general idea for this is to make each Python CONST into an LLVM
GlobalVariable,
mark it constant, and copy the actual value, transitively, into the initializer.
Unfortunately, if we mark the whole thing constant, we can't do things like
update
the refcount. Chris Lattner said we should write an AliasAnalysis with
pointsToConstantMemory() defined to take care of this. I haven't double-checked
that
this actually lets SCCP propagate the initial value places, but Chris is usually
right. :)
Original comment by jyass...@gmail.com
on 17 Jun 2009 at 6:09
r812 added support for mirroring Python objects into LLVM GlobalVariables. Now
we
just need the AA pass.
Original comment by collinw
on 28 Aug 2009 at 10:31
The AA modifications landed in r825. Jeffrey, please reopen if needed.
Original comment by collinw
on 24 Sep 2009 at 4:03
Original issue reported on code.google.com by
collinw
on 17 Jun 2009 at 5:38