The "takeName" logic at the end of ScalarizerVisitor::finish
could end up renaming global variables when having simplified
and extractelement instruction to simply pick a single vector
element. If the input vector to the extractelement instruction
held pointers to global variables we ended up renaming the global
variable.
The patch make sure we only take the name of the replaced Op when
we have added new instructions that might need a useful name.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
@bjope thanks! bugreport kinda skimmed my attention span, i was going to re-look today-ish.
I think this looks fine. The another alternative would be to only do that if the value-to-be-renamed is an instruction,
but then i'm not sure it's an improvement if we rename something that we reused.
Comment Actions
Yes, I actually experimented with adding an isa<Instruction> check first. But then I figured there could be more uses of the scalar value that is extraced from the vector, so changing the name of that value might be more confusing compared to keeping its name. So when comparing the result I preferred this way of solving it.