diff --git a/lib/CodeGen/MIRParser/MILexer.cpp b/lib/CodeGen/MIRParser/MILexer.cpp index 4ebe7cd4371..9d3329a7dbe 100644 --- a/lib/CodeGen/MIRParser/MILexer.cpp +++ b/lib/CodeGen/MIRParser/MILexer.cpp @@ -446,6 +446,7 @@ static MIToken::TokenKind getMetadataKeywordKind(StringRef Identifier) { return StringSwitch(Identifier) .Case("!tbaa", MIToken::md_tbaa) .Case("!alias.scope", MIToken::md_alias_scope) + .Case("!noalias", MIToken::md_noalias) .Default(MIToken::Error); } diff --git a/lib/CodeGen/MIRParser/MILexer.h b/lib/CodeGen/MIRParser/MILexer.h index 33748209e93..4e24c05c7bd 100644 --- a/lib/CodeGen/MIRParser/MILexer.h +++ b/lib/CodeGen/MIRParser/MILexer.h @@ -88,6 +88,7 @@ struct MIToken { // Named metadata keywords md_tbaa, md_alias_scope, + md_noalias, // Identifier tokens Identifier, diff --git a/lib/CodeGen/MIRParser/MIParser.cpp b/lib/CodeGen/MIRParser/MIParser.cpp index 271f7f08227..57765b5b0cb 100644 --- a/lib/CodeGen/MIRParser/MIParser.cpp +++ b/lib/CodeGen/MIRParser/MIParser.cpp @@ -1543,11 +1543,16 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) { 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)) diff --git a/lib/CodeGen/MIRPrinter.cpp b/lib/CodeGen/MIRPrinter.cpp index 6be8205f65e..aa3031657cd 100644 --- a/lib/CodeGen/MIRPrinter.cpp +++ b/lib/CodeGen/MIRPrinter.cpp @@ -786,7 +786,10 @@ void MIPrinter::print(const MachineMemOperand &Op) { 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 << ')'; } diff --git a/test/CodeGen/MIR/X86/memory-operands.mir b/test/CodeGen/MIR/X86/memory-operands.mir index 4a97cd8caa5..6fc6dca2527 100644 --- a/test/CodeGen/MIR/X86/memory-operands.mir +++ b/test/CodeGen/MIR/X86/memory-operands.mir @@ -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