[llvm-commits] [llvm] r162222 - /llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp

Sean Silva silvas at purdue.edu
Mon Aug 20 20:19:10 PDT 2012


Would SmallDenseMap be more efficient here since SmallPtrSet does a
linear scan? There's also a SmallPtrSet of size 64 in the DAG combiner
that I think would significantly benefit from becoming a SmallDenseMap
(64 means that when it is pretty large but still in its small storage
it does a linear scan over up to 8 cache lines).

More generally, in what situations is a SmallPtrSet going to be
preferable to a SmallDenseMap?

--Sean Silva

On Mon, Aug 20, 2012 at 4:52 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
> Author: stoklund
> Date: Mon Aug 20 15:52:03 2012
> New Revision: 162222
>
> URL: http://llvm.org/viewvc/llvm-project?rev=162222&view=rev
> Log:
> Use a SmallPtrSet to dedup successors in EmitSjLjDispatchBlock.
>
> The test case ARM/2011-05-04-MultipleLandingPadSuccs.ll was creating
> duplicate successor list entries.
>
> Modified:
>     llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
>
> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=162222&r1=162221&r2=162222&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 20 15:52:03 2012
> @@ -6151,13 +6151,12 @@
>    }
>
>    // Add the jump table entries as successors to the MBB.
> -  MachineBasicBlock *PrevMBB = 0;
> +  SmallPtrSet<MachineBasicBlock*, 8> SeenMBBs;
>    for (std::vector<MachineBasicBlock*>::iterator
>           I = LPadList.begin(), E = LPadList.end(); I != E; ++I) {
>      MachineBasicBlock *CurMBB = *I;
> -    if (PrevMBB != CurMBB)
> +    if (SeenMBBs.insert(CurMBB))
>        DispContBB->addSuccessor(CurMBB);
> -    PrevMBB = CurMBB;
>    }
>
>    // N.B. the order the invoke BBs are processed in doesn't matter here.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list