[llvm] r274586 - AArch64: try to fix optimized build failure.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 16:15:58 PDT 2016


Author: tnorthover
Date: Tue Jul  5 18:15:58 2016
New Revision: 274586

URL: http://llvm.org/viewvc/llvm-project?rev=274586&view=rev
Log:
AArch64: try to fix optimized build failure.

I think the Ops filled out by Regex::match contain pointers into the temporary
std::string returned by StringRef::upper. Its lifetime is extended by the call
to match, but only until the end of that call (not to the uses of Ops later
on).

Modified:
    llvm/trunk/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp

Modified: llvm/trunk/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp?rev=274586&r1=274585&r2=274586&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp Tue Jul  5 18:15:58 2016
@@ -85,8 +85,9 @@ uint32_t AArch64SysReg::parseGenericRegi
   // Try to parse an S<op0>_<op1>_<Cn>_<Cm>_<op2> register name
   Regex GenericRegPattern("^S([0-3])_([0-7])_C([0-9]|1[0-5])_C([0-9]|1[0-5])_([0-7])$");
 
+  std::string UpperName = Name.upper();
   SmallVector<StringRef, 5> Ops;
-  if (!GenericRegPattern.match(Name.upper(), &Ops))
+  if (!GenericRegPattern.match(UpperName, &Ops))
     return -1;
 
   uint32_t Op0 = 0, Op1 = 0, CRn = 0, CRm = 0, Op2 = 0;




More information about the llvm-commits mailing list