]> granicus.if.org Git - llvm/commitdiff
AArch64: try to fix optimized build failure.
authorTim Northover <tnorthover@apple.com>
Tue, 5 Jul 2016 23:15:58 +0000 (23:15 +0000)
committerTim Northover <tnorthover@apple.com>
Tue, 5 Jul 2016 23:15:58 +0000 (23:15 +0000)
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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274586 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/Utils/AArch64BaseInfo.cpp

index 4a7903d26daa14d3408a4b92e9387f06705fbac9..e65ba1f2401d73898f2cb3c7830dba652f6d4d2d 100644 (file)
@@ -85,8 +85,9 @@ uint32_t AArch64SysReg::parseGenericRegister(StringRef Name) {
   // 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;