[llvm] r245246 - MIR Serialization: Serialize the memory operand's noalias metadata node.

Alex Lorenz via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 15:08:02 PDT 2015


Author: arphaman
Date: Mon Aug 17 17:08:02 2015
New Revision: 245246

URL: http://llvm.org/viewvc/llvm-project?rev=245246&view=rev
Log:
MIR Serialization: Serialize the memory operand's noalias metadata node.

Modified:
    llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp
    llvm/trunk/lib/CodeGen/MIRParser/MILexer.h
    llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
    llvm/trunk/lib/CodeGen/MIRPrinter.cpp
    llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir

Modified: llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp?rev=245246&r1=245245&r2=245246&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp Mon Aug 17 17:08:02 2015
@@ -446,6 +446,7 @@ static MIToken::TokenKind getMetadataKey
   return StringSwitch<MIToken::TokenKind>(Identifier)
       .Case("!tbaa", MIToken::md_tbaa)
       .Case("!alias.scope", MIToken::md_alias_scope)
+      .Case("!noalias", MIToken::md_noalias)
       .Default(MIToken::Error);
 }
 

Modified: llvm/trunk/lib/CodeGen/MIRParser/MILexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.h?rev=245246&r1=245245&r2=245246&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MILexer.h (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.h Mon Aug 17 17:08:02 2015
@@ -88,6 +88,7 @@ struct MIToken {
     // Named metadata keywords
     md_tbaa,
     md_alias_scope,
+    md_noalias,
 
     // Identifier tokens
     Identifier,

Modified: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp?rev=245246&r1=245245&r2=245246&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp Mon Aug 17 17:08:02 2015
@@ -1543,11 +1543,16 @@ bool MIParser::parseMachineMemoryOperand
       if (parseMDNode(AAInfo.Scope))
         return true;
       break;
-    // TODO: Parse AA NoAlias metadata.
+    case MIToken::md_noalias:
+      lex();
+      if (parseMDNode(AAInfo.NoAlias))
+        return true;
+      break;
     // TODO: Parse the ranges metadata.
     // TODO: Report an error on duplicate metadata nodes.
     default:
-      return error("expected 'align' or '!tbaa' or '!alias.scope'");
+      return error(
+          "expected 'align' or '!tbaa' or '!alias.scope' or '!noalias'");
     }
   }
   if (expectAndConsume(MIToken::rparen))

Modified: llvm/trunk/lib/CodeGen/MIRPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRPrinter.cpp?rev=245246&r1=245245&r2=245246&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRPrinter.cpp Mon Aug 17 17:08:02 2015
@@ -786,7 +786,10 @@ void MIPrinter::print(const MachineMemOp
     OS << ", !alias.scope ";
     AAInfo.Scope->printAsOperand(OS, MST);
   }
-  // TODO: Print AA NoAlias metadata.
+  if (AAInfo.NoAlias) {
+    OS << ", !noalias ";
+    AAInfo.NoAlias->printAsOperand(OS, MST);
+  }
   // TODO: Print the ranges metadata.
   OS << ')';
 }

Modified: llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir?rev=245246&r1=245245&r2=245246&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir (original)
+++ llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir Mon Aug 17 17:08:02 2015
@@ -400,7 +400,8 @@ body: |
   ; CHECK-LABEL: name: aa_scope
   ; CHECK: %xmm0 = MOVSSrm %rsi, 1, _, 0, _ :: (load 4 from %ir.c, !alias.scope !9)
     %xmm0 = MOVSSrm %rsi, 1, _, 0, _ :: (load 4 from %ir.c, !alias.scope !9)
-    MOVSSmr %rdi, 1, _, 20, _, killed %xmm0 :: (store 4 into %ir.arrayidx.i)
+  ; CHECK-NEXT: MOVSSmr %rdi, 1, _, 20, _, killed %xmm0 :: (store 4 into %ir.arrayidx.i, !noalias !9)
+    MOVSSmr %rdi, 1, _, 20, _, killed %xmm0 :: (store 4 into %ir.arrayidx.i, !noalias !9)
     %xmm0 = MOVSSrm killed %rsi, 1, _, 0, _ :: (load 4 from %ir.c)
     MOVSSmr killed %rdi, 1, _, 28, _, killed %xmm0 :: (store 4 into %ir.arrayidx)
     RETQ




More information about the llvm-commits mailing list