[LLVMdev] New getelementptr instruction form

Chris Lattner sabre at nondot.org
Tue Sep 10 20:32:00 PDT 2002


I just checked in an important changeset into the LLVM tree to fix a major
problem with the getelementptr instruction (which can cause
misoptimization in some cases, and wierd semantics in the backend).
Instead of using 'uint' arguments to index into SequentialTypes (arrays
and pointers) we now use 'long' arguments.  In the very near future, I'll
update all of the LLVM documentation (including the 'intro to the
infrastructure pdf file) to reflect this change.

The changes that this modifications require are all relatively minor, but
it is quite possible I missed some.  I did try compiling quite a few test
programs, and it seems to work ok.  If there is a place I missed, there
should be a catastrophic error (assertion failure) that stops compilation.
If you run into any of these, let me know.

As it stands, LLC is probably broken due to these changes.  Judging from
earlier discussions with Vikram, it should be realtively easy to support
these in LLC as long as he has time to implement it (in fact, it might
involve removing hacks that are in place to support the old broken
behavior).  Until he gets to it though, LLC probably won't work, so _do
not_ update your tree if you need LLC.

In other, unfortunate, news, it looks like one of my recent changes [to
make it output code that doesn't do bad operations on pointers] broke the
GCC frontend fairly severely.  The testcases I used to make sure it was ok
apparently didn't hit the problems, and I didn't notice until hand
inspection to make sure the getelementptr changes were ok.  I'll try to
fix these problems tonight or tommorow.  I long for the day where I can
have an automated test framework find my bugs for me.  :)

On the positive side, the major architectural changes are done once the
dust settles on these.  :)

-Chris

http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list