[patch][pr10367] Add support for offsets in GlobalAlias

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu May 22 16:25:43 PDT 2014


> A GEP is far more general. In particular:

Reid and I just had a discussion on IRC. His argument (if I understood
it correctly) was that not using a ConstantExpr would just be hiding
the real bug: ConstantExpr itself needs a redesign.

That had been my opinion too in the past. We only disagreed on what
the best path to get there would be. Fix the small bug first
(GlobalAlias) or just be aware of it until the big one is fixed
(ConstantExpr).

During the discussion I realized that GlobalAlias is fundamentally
more restrictive than ConstantExpr. Not just what we have now, but
anything we design as being a ConstantExpr. The issues is that we need
for ConstantExprs to be able to represent relocations. They have to be
able to says "the difference of that address and this one truncated to
32 bits" for example. For the target of a GlobalAlias,  that is not
the case. They are really just a position in the file, no relocations
allowed.

Now, it is always possible to assert that something more general is in
a special context something simpler, but it seems odd to assert that
in the case of GlobalAlias something than can represent a superset of
all relocations we support is actually a 64 bit number.

Cheers,
Rafael



More information about the llvm-commits mailing list