-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -fno-verbose-asm to clang #6462
base: main
Are you sure you want to change the base?
Conversation
This is maybe an Ok change, but calling in @OfekShilon and @mattgodbolt It might be appropriate to only hide these when comments are filtered out, but not sure |
Great find! I wasn't aware of this switch. I looked in the llvm source and indeed it controls only comments, but I'm not sure all are useless. One random example (first in the list): https://github.com/llvm/llvm-project/blob/31774b6a8a88b435ce79f9ba048ef8bb00e2817e/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp#L96-L110 bool VerboseAsm = Asm->OutStreamer->isVerboseAsm();
int Entry = 0;
// Emit the Catch TypeInfos.
if (VerboseAsm && !TypeInfos.empty()) {
Asm->OutStreamer->AddComment(">> Catch TypeInfos <<");
Asm->OutStreamer->addBlankLine();
Entry = TypeInfos.size();
}
for (const GlobalValue *GV : reverse(TypeInfos)) {
if (VerboseAsm)
Asm->OutStreamer->AddComment("TypeInfo " + Twine(Entry--));
Asm->emitTTypeReference(GV, TTypeEncoding);
} Can certainly be useful to anyone debugging ARM exceptions. So I'd say this switch would be activated only when the comments-filter is checked, but that might require a server roundtrip where (I think?) today it isn't required. Do you think that's doable? |
Yeah doing it when comments are filtered out? I dunno. We've had folks asking before for I think I'm ok to merge this, but
|
That sounds like a winner, Ofek; and if we do it right fixes a number of those linked issues too! |
Actually I take it back - after looking at the old issues I think it would be best to indeed link |
@OfekShilon from some quick testing, There's no point in adding /* Type your code here, or load an example. */
int square(int num) {
return num * num;
} @ GNU C17 (GCC) version 15.0.0 20240529 (experimental) (arm-unknown-linux-gnueabihf)
@ compiled by GNU C version 14.1.0, GMP version 6.1.2, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.19-GMP
@ GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
@ options passed: -mfloat-abi=hard -mfpu=neon -mtls-dialect=gnu -mthumb -march=armv7-a+simd -g
square:
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 1, uses_anonymous_args = 0
@ link register save eliminated.
push {r7} @
sub sp, sp, #12 @,,
add r7, sp, #0 @,,
str r0, [r7, #4] @ num, num
@ /app/example.c:3: return num * num;
ldr r3, [r7, #4] @ tmp116, num
mul r3, r3, r3 @ _2, tmp116, tmp116
@ /app/example.c:4: }
mov r0, r3 @, <retval>
adds r7, r7, #12 @,,
mov sp, r7 @,
@ sp needed @
ldr r7, [sp], #4 @,
bx lr @ vs without square:
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 1, uses_anonymous_args = 0
@ link register save eliminated.
push {r7}
sub sp, sp, #12
add r7, sp, #0
str r0, [r7, #4]
ldr r3, [r7, #4]
mul r3, r3, r3
mov r0, r3
adds r7, r7, #12
mov sp, r7
@ sp needed
ldr r7, [sp], #4
bx lr The line numbers |
@verhovsky I assume you're talking about my suggestion I think the small extra-verbosity in the 'all compilation options' is negligible, and also think that if gcc authors added these comments - they aren't noise at least to them. For me personally as a user it is completely acceptable to see some noise when I check some verbosity box like 'comments'. But other opinions are welcome of course - @partouf ? @mattgodbolt ? |
my 2cents: we either do it consistently so we can fix this + the 3 gcc/icc issues, or we don't do it at all and leave as is So I agree with your suggestion @OfekShilon that it should be part of the comments filter |
@verhovsky I think adding this check to
You can grep the source for |
This removes useless comments (namely repeated function/label names,
<n>-byte Folded Spill
and others) from the generated assembly.Fixes #5964