From patchwork Fri Oct 7 20:32:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 13001456 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 390E2C433FE for ; Fri, 7 Oct 2022 20:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229931AbiJGUcw (ORCPT ); Fri, 7 Oct 2022 16:32:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230141AbiJGUct (ORCPT ); Fri, 7 Oct 2022 16:32:49 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2396127BDB for ; Fri, 7 Oct 2022 13:32:40 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id a2-20020a5b0002000000b006b48689da76so5564838ybp.16 for ; Fri, 07 Oct 2022 13:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=H5PXFuGO6LsvTkGWSyH4IIntX/pmrPgQBzEpfjypKsw=; b=kNHjn6x5hUfuwCtRtaf+cYbg52QTq7S6GaEZitIAjgKwdSB3u0cm0l4Z6cQKD87jUI 7G35Df2pOwo9gMegtlSck62AyJCe/hQYv41mG0jr5PlAfqmsxJ6cNbn41KEX8eK0jdAk x00IK7IRfBlhy98VPZbjK0kKoaNqW/+apqS1HiT9CgaBtWfZpXvHBTNzCCO71Xgtsxwz tJcPDlCgmP2sGYhAzqtCk0MkIyVJN8Oe7CbnUo8EpzgQYIM63Z2IbcoSqN3r/6cIXyS8 YVq7TDHTpzUCi016DXCol0Sa1pUcq5lk7P3ZalJgZxc6tcDSo29XOspe2BLCNt1a5pXn FQFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=H5PXFuGO6LsvTkGWSyH4IIntX/pmrPgQBzEpfjypKsw=; b=H9dCA4bkX1LMftpp6HC0Hqayw8PxydxyN/lEFGi4lUR7REcIFrRsNrbpBxn4HvyGmc XQRMD8yijxnl+W3OGzdIxelLQNm5OiE+FBkhyPw4bpxwpxWvXyu7ZgxJefR9gkpLFoU8 UjraY94ww95nj1bpppT53fr3+MjgEC955xkDyvFJo2jDGcsnS1nOj2hFOCQERRwo4EVs gonaZ5ASV0WTqzv04XulVbT0n3eHWzG1Iv88jKYSmsi5Zti8VqyL8oF1QVW8EtI7RLjH P0ki8RT0nCnLLDrZ4W0WEhhf4TFdiQH8xeuQKCDRYNKxZAhS6cMfCt27o2/lm5igXkWS a23g== X-Gm-Message-State: ACrzQf3wZv+UrjPyv2qgKDNk9hssYMb8aTlgWZb8xzdhu4pEdQhMqd3S a3vZUUQrEt5V5w5QDnR0HB60I5Qh3ZwSQKQxg10= X-Google-Smtp-Source: AMsMyM5xkodeESX8Qe1smo5uI+0KcKPVRF8fNmAe7oJoszCv7gYXUaxSXjbqe03Q4+THi22jagWiUXAdbj+BsGqXHJA= X-Received: from ndesaulniers-desktop.svl.corp.google.com ([2620:0:100e:712:35a0:96d6:8c4e:f207]) (user=ndesaulniers job=sendgmr) by 2002:a25:8a8a:0:b0:6bc:e04a:d340 with SMTP id h10-20020a258a8a000000b006bce04ad340mr6415762ybl.549.1665174760237; Fri, 07 Oct 2022 13:32:40 -0700 (PDT) Date: Fri, 7 Oct 2022 13:32:36 -0700 Mime-Version: 1.0 X-Developer-Key: i=ndesaulniers@google.com; a=ed25519; pk=UIrHvErwpgNbhCkRZAYSX0CFd/XFEwqX3D0xqtqjNug= X-Developer-Signature: v=1; a=ed25519-sha256; t=1665174756; l=1716; i=ndesaulniers@google.com; s=20220923; h=from:subject; bh=TzGJay1lXQMdgQA/ZyjvCG6BrJE34h1xkzf3M2zsIDQ=; b=GirJqyZImL21fWOg762M3V4qsRhWN8goTG9W87OS1Xjtj8APnccjbNLrKgsb+Bz7D+7np/E1o89C EmDaEm5BA81mqRB58hnAPO8IdaObGngDH2RIkMQBUmPcBnuRdCgk X-Mailer: git-send-email 2.38.0.rc2.412.g84df46c1b4-goog Message-ID: <20221007203236.1750890-1-ndesaulniers@google.com> Subject: [PATCH] kbuild: add -fno-discard-value-names to cmd_cc_ll_c From: Nick Desaulniers To: Masahiro Yamada Cc: Michal Marek , Nathan Chancellor , Tom Rix , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nick Desaulniers Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org When debugging LLVM IR, it can be handy for clang to not discard value names used for local variables and parameters. Compare the generated IR. Implicit Default (-fdiscard-value-names): define i32 @core_sys_select(i32 %0, ptr %1, ptr %2, ptr %3, ptr %4) { %6 = alloca i64 %7 = alloca %struct.poll_wqueues %8 = alloca [64 x i32] Explicit -fno-discard-value-names: define i32 @core_sys_select(i32 %n, ptr %inp, ptr %outp, ptr %exp, ptr %end_time) { %expire.i = alloca i64 %table.i = alloca %struct.poll_wqueues %stack_fds = alloca [64 x i32] The rule for generating human readable LLVM IR (.ll) is only useful as a debugging feature: $ make LLVM=1 fs/select.ll Clang defaults to -fdiscard-value-names to save memory when generating LLVM IR. For debugging purposes, the improvement in readability at a cost of more verbose IR is a cost we're happy to pay. Signed-off-by: Nick Desaulniers Reviewed-by: Nathan Chancellor Reviewed-by: Fangrui Song --- scripts/Makefile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 93ed07a23fd08b8613f64cf0a15d7fbdaca010fd diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 27be77c0d6d8..d0e4f476dfee 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -140,7 +140,7 @@ $(obj)/%.symtypes : $(src)/%.c FORCE # LLVM assembly # Generate .ll files from .c quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@ - cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $< + cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -fno-discard-value-names -o $@ $< $(obj)/%.ll: $(src)/%.c FORCE $(call if_changed_dep,cc_ll_c)