[llvm] r245245 - MIR Serialization: Serialize the memory operand's alias scope metadata node.

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


Author: arphaman
Date: Mon Aug 17 17:06:40 2015
New Revision: 245245

URL: http://llvm.org/viewvc/llvm-project?rev=245245&view=rev
Log:
MIR Serialization: Serialize the memory operand's alias scope 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=245245&r1=245244&r2=245245&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp Mon Aug 17 17:06:40 2015
@@ -445,6 +445,7 @@ static Cursor maybeLexNumericalLiteral(C
 static MIToken::TokenKind getMetadataKeywordKind(StringRef Identifier) {
   return StringSwitch<MIToken::TokenKind>(Identifier)
       .Case("!tbaa", MIToken::md_tbaa)
+      .Case("!alias.scope", MIToken::md_alias_scope)
       .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=245245&r1=245244&r2=245245&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MILexer.h (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.h Mon Aug 17 17:06:40 2015
@@ -87,6 +87,7 @@ struct MIToken {
 
     // Named metadata keywords
     md_tbaa,
+    md_alias_scope,
 
     // 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=245245&r1=245244&r2=245245&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp Mon Aug 17 17:06:40 2015
@@ -1538,12 +1538,16 @@ bool MIParser::parseMachineMemoryOperand
       if (parseMDNode(AAInfo.TBAA))
         return true;
       break;
-    // TODO: Parse AA Scope metadata.
+    case MIToken::md_alias_scope:
+      lex();
+      if (parseMDNode(AAInfo.Scope))
+        return true;
+      break;
     // TODO: Parse AA NoAlias metadata.
     // TODO: Parse the ranges metadata.
     // TODO: Report an error on duplicate metadata nodes.
     default:
-      return error("expected 'align' or '!tbaa'");
+      return error("expected 'align' or '!tbaa' or '!alias.scope'");
     }
   }
   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=245245&r1=245244&r2=245245&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRPrinter.cpp Mon Aug 17 17:06:40 2015
@@ -782,7 +782,10 @@ void MIPrinter::print(const MachineMemOp
     OS << ", !tbaa ";
     AAInfo.TBAA->printAsOperand(OS, MST);
   }
-  // TODO: Print AA Scope metadata.
+  if (AAInfo.Scope) {
+    OS << ", !alias.scope ";
+    AAInfo.Scope->printAsOperand(OS, MST);
+  }
   // TODO: Print AA NoAlias metadata.
   // 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=245245&r1=245244&r2=245245&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:06:40 2015
@@ -132,6 +132,22 @@
   !7 = !{!"XXH_state64_t", !3, i64 0, !3, i64 4, !8, i64 8, !8, i64 16, !8, i64 24}
   !8 = !{!"long long", !4, i64 0}
 
+  define void @aa_scope(float* nocapture %a, float* nocapture readonly %c) #1 {
+  entry:
+    %0 = load float, float* %c, align 4, !alias.scope !9
+    %arrayidx.i = getelementptr inbounds float, float* %a, i64 5
+    store float %0, float* %arrayidx.i, align 4, !noalias !9
+    %1 = load float, float* %c, align 4
+    %arrayidx = getelementptr inbounds float, float* %a, i64 7
+    store float %1, float* %arrayidx, align 4
+    ret void
+  }
+
+  attributes #1 = { nounwind uwtable }
+
+  !9 = distinct !{!9, !10, !"some scope"}
+  !10 = distinct !{!10, !"some domain"}
+
 ...
 ---
 name:            test
@@ -372,3 +388,20 @@ body: |
     %eax = MOV32rm killed %rax, 1, _, 0, _ :: (load 4 from %ir.total_len2, !tbaa !6)
     RETQ %eax
 ...
+---
+name:            aa_scope
+tracksRegLiveness: true
+liveins:
+  - { reg: '%rdi' }
+  - { reg: '%rsi' }
+body: |
+  bb.0.entry:
+    liveins: %rdi, %rsi
+  ; 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)
+    %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