XCore target: fix bug in XCoreLowerThreadLocal.cpp

Richard Osborne richard at xmos.com
Mon Sep 23 10:22:33 PDT 2013


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/20130923/76ccefb1/attachment.html>


More information about the llvm-commits mailing list