[PATCH] [OPENMP] Codegen for 'if' clause

John McCall rjmccall at gmail.com
Fri Oct 10 12:03:18 PDT 2014


================
Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:145
@@ +144,3 @@
+    ThreadID = CGF.EmitLoadOfLValue(LVal, SourceLocation()).getScalarVal();
+    // If value loaded in entry block, use it everywhere in function.
+    if (CGF.Builder.GetInsertBlock() == CGF.AllocaInsertPt->getParent())
----------------
ABataev wrote:
> rjmccall wrote:
> > Is there a reason we can't safely always load in the entry block?
> Yes, actually this ThreadIdVar may be a function parameter. CodeGenFunction generates additional alloca for parameters and stores param to this generated new alloca. If currently we're not in EntryBlock I can't define where to put instructions with value loading, because I don't know where this store instruction. Loads must be dominated by this store, but I just can't guarantee it.
Makes sense.  Optimized builds will completely eliminate this as a concern, I think.

http://reviews.llvm.org/D4716






More information about the cfe-commits mailing list