[llvm] r204431 - [Constant Hoisting] Replace the MapVector with a separate Map and Vector to keep track of constant candidates.

David Blaikie dblaikie at gmail.com
Tue Mar 25 11:31:05 PDT 2014

On Tue, Mar 25, 2014 at 11:24 AM, Juergen Ributzka <juergen at apple.com> wrote:
> I could clear the map right after constant candidate collection is done,
> because it is only used there. Or I could make it a local map that never
> gets exposed to the other method.

Yeah, that might be nice - having it local to "void
collectConstantCandidates(Function &Fn);" and you'd have to pass it
down through "void collectConstantCandidates(Instruction *Inst);" and
"collectConstantCandidates(Instruction *Inst, unsigned Idx,
ConstantInt *ConstInt);" but that seems OK-ish...

But I'm less (read not-at-all) familiar with this code, so don't know
how much it matters - just from an external perspective it seemed like
a constraint was being broken that could be confusing.

> On Mar 21, 2014, at 1:54 PM, David Blaikie <dblaikie at gmail.com> wrote:
> Would it be useful to invalidate the map and/or vector when this sort
> operation occurs? Perhaps emptying both the map and vector (simply
> std::move the vector into a local, sort it, use it, then leave the
> function with both map and vector empty - since leaving them non-empty
> is just a trap for someone later?)

More information about the llvm-commits mailing list