[PATCH] D38259: [OpenMP] Fix translation of target args

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 25 14:10:51 PDT 2017


Hahnfeld created this revision.

ToolChain::TranslateArgs() returns nullptr if no changes are performed.
This would currently mean that OpenMPArgs are lost. Patch fixes this
by falling back to simply using OpenMPArgs in that case.


https://reviews.llvm.org/D38259

Files:
  lib/Driver/Compilation.cpp


Index: lib/Driver/Compilation.cpp
===================================================================
--- lib/Driver/Compilation.cpp
+++ lib/Driver/Compilation.cpp
@@ -57,14 +57,16 @@
         *TranslatedArgs, DeviceOffloadKind, AllocatedArgs);
     if (!OpenMPArgs) {
       Entry = TC->TranslateArgs(*TranslatedArgs, BoundArch, DeviceOffloadKind);
+      if (!Entry)
+        Entry = TranslatedArgs;
     } else {
       Entry = TC->TranslateArgs(*OpenMPArgs, BoundArch, DeviceOffloadKind);
-      delete OpenMPArgs;
+      if (!Entry)
+        Entry = OpenMPArgs;
+      else
+        delete OpenMPArgs;
     }
 
-    if (!Entry)
-      Entry = TranslatedArgs;
-
     // Add allocated arguments to the final DAL.
     for (auto ArgPtr : AllocatedArgs) {
       Entry->AddSynthesizedArg(ArgPtr);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38259.116610.patch
Type: text/x-patch
Size: 798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170925/7ed602f2/attachment.bin>


More information about the cfe-commits mailing list