r220165 moves GlobalAlias handling to be before GlobalValue handling, otherwise it's dead code. Unfortunately, that also moved it to be before the max depth check, causing an assert.
Moved it forward to where it's safe, and changed the GlobalValue handling to only look at GlobalObjects.
Sorry for the awful test-case, this is bugpoint-reduced C++ with a bit of manual clean-up. I can try to clean it up more, if necessary.
You could make this more concise with auto *GO = dyn_cast<GlobalObject>(V)).