Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion llvm/lib/MC/MCParser/AsmLexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,10 @@ AsmToken AsmLexer::LexToken() {
return LexLineComment();
}

if (isAtStartOfComment(TokStart))
if (isAtStartOfComment(TokStart)) {
CurPtr += MAI.getCommentString().size() - 1;
return LexLineComment();
}

if (isAtStatementSeparator(TokStart)) {
CurPtr += strlen(MAI.getSeparatorString()) - 1;
Expand Down
11 changes: 11 additions & 0 deletions llvm/test/MC/AsmParser/preserve-comments-aarch64-linux.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// REQUIRES: aarch64-registered-target
// llvm-mc prints leading tabs, formatting of this test follows preserve-comments.s
// RUN: llvm-mc -preserve-comments -n -triple aarch64-unknown-linux-gnu %s -o %t
// RUN: diff -b %s %t

.text

foo:
// comment here
nop
// comment here too
36 changes: 36 additions & 0 deletions llvm/test/tools/llvm-mca/AArch64/Neoverse/llvm-mca-markers.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py
// RUN: llvm-mca -mtriple=aarch64-unknown-linux-gnu -mcpu=neoverse-v2 -iterations=1 -resource-pressure=false < %s | FileCheck %s

.text
// LLVM-MCA-BEGIN Empty
// Empty sequence
// LLVM-MCA-END

mul x1, x1, x1
// LLVM-MCA-BEGIN NotEmpty
add x0, x0, x1
// LLVM-MCA-END
mul x2, x2, x2

# CHECK: [0] Code Region - NotEmpty

# CHECK: Iterations: 1
# CHECK-NEXT: Instructions: 1
# CHECK-NEXT: Total Cycles: 4
# CHECK-NEXT: Total uOps: 1

# CHECK: Dispatch Width: 6
# CHECK-NEXT: uOps Per Cycle: 0.25
# CHECK-NEXT: IPC: 0.25
# CHECK-NEXT: Block RThroughput: 0.2

# CHECK: Instruction Info:
# CHECK-NEXT: [1]: #uOps
# CHECK-NEXT: [2]: Latency
# CHECK-NEXT: [3]: RThroughput
# CHECK-NEXT: [4]: MayLoad
# CHECK-NEXT: [5]: MayStore
# CHECK-NEXT: [6]: HasSideEffects (U)

# CHECK: [1] [2] [3] [4] [5] [6] Instructions:
# CHECK-NEXT: 1 1 0.17 add x0, x0, x1