This is an archive of the discontinued LLVM Phabricator instance.

[GlobalOpt] Sort members of llvm.used deterministically

Authored by JakeVanAdrighem on Sep 14 2015, 10:37 AM.



Fix the way we sort the llvm.used and llvm.compiler.used members.

This bug seems to have been introduced in rL183756 through a set of improper casts to GlobalValue*. In subsequent patches this problem was missed and transformed into a getName call on a ConstantExpr.

Diff Detail


Event Timeline

JakeVanAdrighem retitled this revision from to [GlobalOpt] Sort members of llvm.used deterministically.
JakeVanAdrighem updated this object.
JakeVanAdrighem updated this object.
JakeVanAdrighem added a subscriber: llvm-commits.
silvas added a subscriber: silvas.Sep 14 2015, 1:56 PM

How did you find this?

When iterating with a set of passes manually, I found that GlobalOpt was not reaching a fixed point but was not reporting any changes.

silvas accepted this revision.Sep 21 2015, 8:45 PM
silvas added a reviewer: silvas.

LGTM. Any idea why this wasn't causing test failures from unstable qsort's?

This revision is now accepted and ready to land.Sep 21 2015, 8:45 PM

I think it was able to avoid test failure simply because there are so few elements in the existing test that compareNames in qsort just happened to produce the same results each time.

Makes sense. Do you need me to commit this for you?

  • Sean Silva

If you could, please.

This revision was automatically updated to reflect the committed changes.