XCore target: fix bug in XCoreLowerThreadLocal.cpp

Robert Lytton robert at xmos.com
Tue Sep 24 02:02:00 PDT 2013


Hi Richard,
The code has been changed to handle duplicate constant expressions in the phi instruction  (only triggers under O0).
Robert

________________________________
From: Richard Osborne
Sent: 23 September 2013 18:22
To: Robert Lytton
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: XCore target: fix bug in XCoreLowerThreadLocal.cpp

Hi Robert,

+          // in the calling BB, infront of the branch instruction.

calling BB doesn't seem the right terminology, how about: in the predecessor, before the branch instruction.

+          if (PHINode *PN = dyn_cast<PHINode>(WU))
+            for (int I=0, E=PN->getNumIncomingValues(); I < E; ++I)
+              if (PN->getIncomingValue(I) == CE) {
+                InsertPos = &PN->getIncomingBlock(I)->back();
+                break;
+              }
+          Instruction *NewInst = createReplacementInstr(CE, InsertPos);

What happens if the constant expression appears twice in the phi instruction? Also there should be spaces around '='

On 23/09/13 17:59, Robert Lytton wrote:
Hi,

Attached is a patch to fix:

   XCore target: fix bug in XCoreLowerThreadLocal.cpp

    When a ConstantExpr which uses a thread local is part of a PHI node
    instruction, the insruction that replaces the ConstantExpr must
    be inserted in the calling block just before the branch instruction.


Robert



--
Richard Osborne | XMOS
http://www.xmos.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130924/4fdf1617/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PatchThreadLocalPHI
Type: application/octet-stream
Size: 3059 bytes
Desc: PatchThreadLocalPHI
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130924/4fdf1617/attachment.obj>


More information about the llvm-commits mailing list