[cfe-commits] r115586 - /cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Daniel Dunbar daniel at zuster.org
Tue Oct 5 06:20:34 PDT 2010


Test case?

 - Daniel

On Mon, Oct 4, 2010 at 7:33 PM, John McCall <rjmccall at apple.com> wrote:
> Author: rjmccall
> Date: Mon Oct  4 21:33:56 2010
> New Revision: 115586
>
> URL: http://llvm.org/viewvc/llvm-project?rev=115586&view=rev
> Log:
> If we're resolving all outstanding fixups, and there are multiple fixups
> for the same destination, then we must potentially rewrite the initial branch
> of every fixup.  Without this patch, a short-circuit check meant to prevent
> a switch case from being redundantly added was preventing later fixups from
> being processed.  Fixes PR8175 (again).
>
>
> Modified:
>    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=115586&r1=115585&r2=115586&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Mon Oct  4 21:33:56 2010
> @@ -1340,11 +1340,9 @@
>   llvm::SmallPtrSet<llvm::BasicBlock*, 4> CasesAdded;
>
>   for (unsigned I = 0, E = CGF.EHStack.getNumBranchFixups(); I != E; ++I) {
> -    // Skip this fixup if its destination isn't set or if we've
> -    // already treated it.
> +    // Skip this fixup if its destination isn't set.
>     BranchFixup &Fixup = CGF.EHStack.getBranchFixup(I);
>     if (Fixup.Destination == 0) continue;
> -    if (!CasesAdded.insert(Fixup.Destination)) continue;
>
>     // If there isn't an OptimisticBranchBlock, then InitialBranch is
>     // still pointing directly to its destination; forward it to the
> @@ -1361,6 +1359,9 @@
>       Fixup.InitialBranch->setSuccessor(0, CleanupEntry);
>     }
>
> +    // Don't add this case to the switch statement twice.
> +    if (!CasesAdded.insert(Fixup.Destination)) continue;
> +
>     Switch->addCase(CGF.Builder.getInt32(Fixup.DestinationIndex),
>                     Fixup.Destination);
>   }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list