[llvm-commits] [llvm] r57025 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll

Owen Anderson resistor at mac.com
Fri Oct 3 12:08:20 PDT 2008


On Oct 3, 2008, at 11:57 AM, Devang Patel wrote:
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Oct  3  
> 13:57:37 2008
> @@ -1051,7 +1051,7 @@
>   BasicBlock::iterator InsertPos = BI;
>   if (InsertPos != BIParent->begin())
>     --InsertPos;
> -  if (InsertPos == BrCond) {
> +  if (InsertPos == BrCond && !isa<PHINode>(BrCond)) {
>     SmallPtrSet<Instruction *, 4> BB1Insns;
>     for(BasicBlock::iterator BB1I = BB1->begin(), BB1E = BB1->end();
>         BB1I != BB1E; ++BB1I)

I'm not sure this is the right fix.  It handles this specific case,  
but I'm not sure it works in general.  I think what you want is  
something more like:

BasicBlock::iterator InsertPos = BI;
if (&*InsertPos != BIParent->getFirstNonPHI())
   --InsertPos;
if (InsertPos == BrCond) ...

I
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20081003/c8aa04e9/attachment.bin>


More information about the llvm-commits mailing list