[PATCH] D22140: Make a std::string copy of StringRef Name so that it remains valid when the original Name is overridden.

Eric Liu via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 09:13:23 PDT 2016


ioeric updated this revision to Diff 63243.
ioeric added a comment.

- Move setName after accessing Name


http://reviews.llvm.org/D22140

Files:
  lib/IR/AutoUpgrade.cpp

Index: lib/IR/AutoUpgrade.cpp
===================================================================
--- lib/IR/AutoUpgrade.cpp
+++ lib/IR/AutoUpgrade.cpp
@@ -345,7 +345,6 @@
     if (IsX86 && (Name.startswith("avx512.mask.pslli.") ||
                   Name.startswith("avx512.mask.psrai.") ||
                   Name.startswith("avx512.mask.psrli."))) {
-      F->setName("llvm.x86." + Name + ".old");
       Intrinsic::ID ShiftID;
       if (Name.slice(12, 16) == "psll")
         ShiftID = Name[18] == 'd' ? Intrinsic::x86_avx512_mask_psll_di_512
@@ -356,6 +355,7 @@
       else
         ShiftID = Name[18] == 'd' ? Intrinsic::x86_avx512_mask_psrl_di_512
                                   : Intrinsic::x86_avx512_mask_psrl_qi_512;
+      F->setName("llvm.x86." + Name + ".old");
       NewFn = Intrinsic::getDeclaration(F->getParent(), ShiftID);
       return true;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22140.63243.patch
Type: text/x-patch
Size: 875 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160708/92575ff8/attachment.bin>


More information about the llvm-commits mailing list