[AsmPrinter] Don't assert on GOT equivalent non-constant users.

We used to dyn_cast<Constant> in the recursive call, but cast<> in the
initial one, and there can be non-Constant initial users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233346 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ahmed Bougacha 2015-03-27 01:40:54 +00:00
parent 9f2b49c521
commit f265603512
2 changed files with 6 additions and 1 deletions

View File

@ -957,7 +957,7 @@ static bool isGOTEquivalentCandidate(const GlobalVariable *GV,
// To be a got equivalent, at least one of its users need to be a constant // To be a got equivalent, at least one of its users need to be a constant
// expression used by another global variable. // expression used by another global variable.
for (auto *U : GV->users()) for (auto *U : GV->users())
NumGOTEquivUsers += getNumGlobalVariableUses(cast<Constant>(U)); NumGOTEquivUsers += getNumGlobalVariableUses(dyn_cast<Constant>(U));
return NumGOTEquivUsers > 0; return NumGOTEquivUsers > 0;
} }

View File

@ -79,3 +79,8 @@ define i32 @t0(i32 %a) {
to i32), %a to i32), %a
ret i32 %x ret i32 %x
} }
; Also test direct instruction uses.
define i32** @t1() {
ret i32** @bargotequiv
}