[PATCH] D128612: RISC-V big-endian support implementation

2023-05-17 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D128612#4349291 , @asb wrote:

> In D128612#4349259 , @djtodoro 
> wrote:
>
>> In D128612#4345912 , @asb wrote:
>>
>>> In D128612#4337037 , @djtodoro 
>>> wrote:
>>>
 Hi! I am wondering if someone knows what is the status of this.
>>>
>>> I've not seen any further progress. I think it needs at a minimum a PR 
>>> against the psABI doc for big endian that we can review against.
>>
>> OK. Can you please share with me the GCC PR, so I can take a look how it 
>> should be done :)
>
> Based on comments here it sounds like GCC merged some level of support 
> without submitting corresponding changes to the psABI. I don't have those 
> patches to hand, but you can probably find them on the GCC patches list. I 
> think we've had enough unexpected compatibility issues by now that it's not 
> really justifiable to merge something that's meant to be a standard ABI 
> without having the corresponding psABI patch (even if it appears simple). I 
> don't think anyone has posted such a psABI patch but there is/was a tracking 
> issue for it on the psABI repo.

Yeah, if the https://github.com/riscv-non-isa/riscv-elf-psabi-doc is the repo, 
I was not able to find the PR for GCC. And I think the support within GCC is 
somewhat finished.

> @kito-cheng is the bigendian RISC-V work in GCC still active at all? I'm 
> wondering if there's a connection you could help make for Djordje.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128612/new/

https://reviews.llvm.org/D128612

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128612: RISC-V big-endian support implementation

2023-05-17 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D128612#4345912 , @asb wrote:

> In D128612#4337037 , @djtodoro 
> wrote:
>
>> Hi! I am wondering if someone knows what is the status of this.
>
> I've not seen any further progress. I think it needs at a minimum a PR 
> against the psABI doc for big endian that we can review against.

OK. Can you please share with me the GCC PR, so I can take a look how it should 
be done :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128612/new/

https://reviews.llvm.org/D128612

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128612: RISC-V big-endian support implementation

2023-05-12 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.
Herald added a subscriber: luke.

Hi! I wondering if someone knows what is the status of this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128612/new/

https://reviews.llvm.org/D128612

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D115351: [Debugify] Port verify-debuginfo-preserve to NewPM

2022-07-06 Thread Djordje Todorovic via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb5b6d3a41b4e: [Debugify] Port verify-debuginfo-preserve to 
NewPM (authored by ntesic, committed by djtodoro).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115351/new/

https://reviews.llvm.org/D115351

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Transforms/Utils/Debugify.h
  llvm/lib/Transforms/Utils/Debugify.cpp
  llvm/test/DebugInfo/debugify-original-no-dbg-info.ll
  llvm/test/DebugInfo/verify-di-preserve.ll
  llvm/test/Transforms/Util/Debugify/loc-only-original-mode.ll
  llvm/tools/opt/NewPMDriver.cpp
  llvm/tools/opt/NewPMDriver.h
  llvm/tools/opt/opt.cpp

Index: llvm/tools/opt/opt.cpp
===
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -206,18 +206,6 @@
 cl::desc("Start the pipeline with collecting and end it with checking of "
  "debug info preservation."));
 
-static cl::opt VerifyEachDebugInfoPreserve(
-"verify-each-debuginfo-preserve",
-cl::desc("Start each pass with collecting and end it with checking of "
- "debug info preservation."));
-
-static cl::opt
-VerifyDIPreserveExport("verify-di-preserve-export",
-   cl::desc("Export debug info preservation failures into "
-"specified (JSON) file (should be abs path as we use"
-" append mode to insert new JSON objects)"),
-   cl::value_desc("filename"), cl::init(""));
-
 static cl::opt
 PrintBreakpoints("print-breakpoints-for-testing",
  cl::desc("Print select breakpoints location for testing"));
@@ -823,7 +811,8 @@
ThinLinkOut.get(), RemarksFile.get(), Pipeline,
Passes, PluginList, OK, VK, PreserveAssemblyUseListOrder,
PreserveBitcodeUseListOrder, EmitSummaryIndex,
-   EmitModuleHash, EnableDebugify)
+   EmitModuleHash, EnableDebugify,
+   VerifyDebugInfoPreserve)
? 0
: 1;
   }
Index: llvm/tools/opt/NewPMDriver.h
===
--- llvm/tools/opt/NewPMDriver.h
+++ llvm/tools/opt/NewPMDriver.h
@@ -33,6 +33,9 @@
 extern cl::opt DebugifyEach;
 extern cl::opt DebugifyExport;
 
+extern cl::opt VerifyEachDebugInfoPreserve;
+extern cl::opt VerifyDIPreserveExport;
+
 namespace opt_tool {
 enum OutputKind {
   OK_NoOutput,
@@ -74,7 +77,7 @@
  bool ShouldPreserveAssemblyUseListOrder,
  bool ShouldPreserveBitcodeUseListOrder,
  bool EmitSummaryIndex, bool EmitModuleHash,
- bool EnableDebugify);
+ bool EnableDebugify, bool VerifyDIPreserve);
 } // namespace llvm
 
 #endif
Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -49,6 +49,19 @@
 DebugifyExport("debugify-export",
cl::desc("Export per-pass debugify statistics to this file"),
cl::value_desc("filename"));
+
+cl::opt VerifyEachDebugInfoPreserve(
+"verify-each-debuginfo-preserve",
+cl::desc("Start each pass with collecting and end it with checking of "
+ "debug info preservation."));
+
+cl::opt
+VerifyDIPreserveExport("verify-di-preserve-export",
+   cl::desc("Export debug info preservation failures into "
+"specified (JSON) file (should be abs path as we use"
+" append mode to insert new JSON objects)"),
+   cl::value_desc("filename"), cl::init(""));
+
 } // namespace llvm
 
 enum class DebugLogging { None, Normal, Verbose, Quiet };
@@ -280,7 +293,7 @@
bool ShouldPreserveAssemblyUseListOrder,
bool ShouldPreserveBitcodeUseListOrder,
bool EmitSummaryIndex, bool EmitModuleHash,
-   bool EnableDebugify) {
+   bool EnableDebugify, bool VerifyDIPreserve) {
   bool VerifyEachPass = VK == VK_VerifyEachPass;
 
   Optional P;
@@ -337,8 +350,19 @@
   PrintPassOpts);
   SI.registerCallbacks(PIC, );
   DebugifyEachInstrumentation Debugify;
-  if (DebugifyEach)
+  DebugifyStatsMap DIStatsMap;
+  DebugInfoPerPass DebugInfoBeforePass;
+  if (DebugifyEach) {
+Debugify.setDIStatsMap(DIStatsMap);
+Debugify.setDebugifyMode(DebugifyMode::SyntheticDebugInfo);
+Debugify.registerCallbacks(PIC);
+  } else if (VerifyEachDebugInfoPreserve) {
+

[PATCH] D115622: [Debugify] Optimize debugify original mode

2022-03-22 Thread Djordje Todorovic via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG73777b4c35a3: [Debugify] Optimize debugify original mode 
(authored by djtodoro).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115622/new/

https://reviews.llvm.org/D115622

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Transforms/Utils/Debugify.h
  llvm/lib/Transforms/Utils/Debugify.cpp
  llvm/tools/opt/opt.cpp
  llvm/unittests/Transforms/Utils/DebugifyTest.cpp

Index: llvm/unittests/Transforms/Utils/DebugifyTest.cpp
===
--- llvm/unittests/Transforms/Utils/DebugifyTest.cpp
+++ llvm/unittests/Transforms/Utils/DebugifyTest.cpp
@@ -121,15 +121,15 @@
 
   DebugInfoDrop *P = new DebugInfoDrop();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
@@ -172,15 +172,15 @@
 
   DebugValueDrop *P = new DebugValueDrop();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
@@ -225,15 +225,15 @@
 
   DebugInfoDummyAnalysis *P = new DebugInfoDummyAnalysis();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
Index: llvm/tools/opt/opt.cpp
===
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -858,13 +858,13 @@
   // the (-check)-debugify passes.
   DebugifyCustomPassManager Passes;
   DebugifyStatsMap DIStatsMap;
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DebugInfoBeforePass;
   if (DebugifyEach) {
 Passes.setDebugifyMode(DebugifyMode::SyntheticDebugInfo);
 Passes.setDIStatsMap(DIStatsMap);
   } else if (VerifyEachDebugInfoPreserve) {
 Passes.setDebugifyMode(DebugifyMode::OriginalDebugInfo);
-Passes.setDIPreservationMap(DIPreservationMap);
+Passes.setDebugInfoBeforePass(DebugInfoBeforePass);
 if (!VerifyDIPreserveExport.empty())
   Passes.setOrigDIVerifyBugsReportFilePath(VerifyDIPreserveExport);
   }
@@ -884,10 +884,10 @@
   Passes.setDIStatsMap(DIStatsMap);
   Passes.add(createDebugifyModulePass());
 } else if (VerifyDebugInfoPreserve) {
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DebugInfoBeforePass);
   Passes.add(createDebugifyModulePass(
   DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
 }
   }
 
@@ -1026,7 +1026,7 @@
 Passes.setOrigDIVerifyBugsReportFilePath(VerifyDIPreserveExport);
   Passes.add(createCheckDebugifyModulePass(
   false, "", nullptr, DebugifyMode::OriginalDebugInfo,
- 

[PATCH] D115622: [Debugify] Optimize debugify original mode

2022-03-18 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 416438.
djtodoro added a comment.
Herald added a project: All.

- Move the skipping into the for-loop since we want to collect metadata for the 
functions that are not observed in the previous Pass (for example the function 
wasn't of interest due to having an attribute attached that wasn't relevant for 
the previous Pass) -- the improvement is still ~2x

Again, Sorry for delay here and, @Orlando @StephenTozer thank you a lot for 
your comments!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115622/new/

https://reviews.llvm.org/D115622

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Transforms/Utils/Debugify.h
  llvm/lib/Transforms/Utils/Debugify.cpp
  llvm/tools/opt/opt.cpp
  llvm/unittests/Transforms/Utils/DebugifyTest.cpp

Index: llvm/unittests/Transforms/Utils/DebugifyTest.cpp
===
--- llvm/unittests/Transforms/Utils/DebugifyTest.cpp
+++ llvm/unittests/Transforms/Utils/DebugifyTest.cpp
@@ -121,15 +121,15 @@
 
   DebugInfoDrop *P = new DebugInfoDrop();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
@@ -172,15 +172,15 @@
 
   DebugValueDrop *P = new DebugValueDrop();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
@@ -225,15 +225,15 @@
 
   DebugInfoDummyAnalysis *P = new DebugInfoDummyAnalysis();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
Index: llvm/tools/opt/opt.cpp
===
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -829,13 +829,13 @@
   // the (-check)-debugify passes.
   DebugifyCustomPassManager Passes;
   DebugifyStatsMap DIStatsMap;
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DebugInfoBeforePass;
   if (DebugifyEach) {
 Passes.setDebugifyMode(DebugifyMode::SyntheticDebugInfo);
 Passes.setDIStatsMap(DIStatsMap);
   } else if (VerifyEachDebugInfoPreserve) {
 Passes.setDebugifyMode(DebugifyMode::OriginalDebugInfo);
-Passes.setDIPreservationMap(DIPreservationMap);
+Passes.setDebugInfoBeforePass(DebugInfoBeforePass);
 if (!VerifyDIPreserveExport.empty())
   Passes.setOrigDIVerifyBugsReportFilePath(VerifyDIPreserveExport);
   }
@@ -855,10 +855,10 @@
   Passes.setDIStatsMap(DIStatsMap);
   Passes.add(createDebugifyModulePass());
 } else if (VerifyDebugInfoPreserve) {
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DebugInfoBeforePass);
   Passes.add(createDebugifyModulePass(
   DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
 

[PATCH] D121100: [clang][DebugInfo] clang should not generate DW_TAG_subprogram entry without DW_AT_name

2022-03-10 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Hmmm... if this should be done within compiler side, I am wondering whether 
this should be resolved in AsmPrinter/DwarfDebug instead.
@aprantl please let me know wyt?

However, it looks like that after this hack the `name` here isn't the 
appropriate one... and it looks like something that debuggers should know how 
to workout ...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121100/new/

https://reviews.llvm.org/D121100

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D115510: [clang][OpenMP][DebugInfo] Debug support for variables in shared clause of OpenMP task construct

2021-12-21 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro accepted this revision.
djtodoro added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:-4446
+// Generate llvm.dbg.declare for each shared variable and
+// DIExpression = metadata !DIExpression(DW_OP_plus_uconst, OFFSET,
+// DW_OP_deref)

nit: We could improve this comment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115510/new/

https://reviews.llvm.org/D115510

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D115622: [Debugify] Optimize debugify original mode

2021-12-13 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro created this revision.
djtodoro added reviewers: Orlando, StephenTozer.
djtodoro added projects: debug-info, LLVM.
Herald added subscribers: ormris, hiraditya.
djtodoro requested review of this revision.
Herald added a project: clang.
Herald added subscribers: llvm-commits, cfe-commits.

Before we start addressing the issue with having a lot of false positives when 
using debugify in the original mode, we have made a few patches that should 
speed up the execution of the testing utility Passes.

For example, when testing a large project (let's say LLVM project itself), we 
can face a lot of potential DI issues. Usually, we use 
`-verify-each-debuginfo-preserve` (that is very similar to `-debugify-each`) -- 
it collects DI metadata before each Pass, and after the Pass it checks if the 
Pass preserved the DI metadata. However, we can speed up this process, since we 
don't need to collect DI metadata before each pass -- we could use the DI 
metadata that are collected after the previous Pass from the pipeline as an 
input for the next Pass.

This patch speeds up the utility for ~2x.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115622

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Transforms/Utils/Debugify.h
  llvm/lib/Transforms/Utils/Debugify.cpp
  llvm/tools/opt/opt.cpp
  llvm/unittests/Transforms/Utils/DebugifyTest.cpp

Index: llvm/unittests/Transforms/Utils/DebugifyTest.cpp
===
--- llvm/unittests/Transforms/Utils/DebugifyTest.cpp
+++ llvm/unittests/Transforms/Utils/DebugifyTest.cpp
@@ -121,15 +121,15 @@
 
   DebugInfoDrop *P = new DebugInfoDrop();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
@@ -172,15 +172,15 @@
 
   DebugValueDrop *P = new DebugValueDrop();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
@@ -225,15 +225,15 @@
 
   DebugInfoDummyAnalysis *P = new DebugInfoDummyAnalysis();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
Index: llvm/tools/opt/opt.cpp
===
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -829,13 +829,13 @@
   // the (-check)-debugify passes.
   DebugifyCustomPassManager Passes;
   DebugifyStatsMap DIStatsMap;
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DebugInfoBeforePass;
   if (DebugifyEach) {
 Passes.setDebugifyMode(DebugifyMode::SyntheticDebugInfo);
 Passes.setDIStatsMap(DIStatsMap);
   } else if (VerifyEachDebugInfoPreserve) {
 Passes.setDebugifyMode(DebugifyMode::OriginalDebugInfo);
-Passes.setDIPreservationMap(DIPreservationMap);
+

[PATCH] D114631: [DebugInfo][InstrRef] Turn instruction referencing on by default for x86

2021-11-30 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro accepted this revision.
djtodoro added a comment.
This revision is now accepted and ready to land.

lgtm, thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114631/new/

https://reviews.llvm.org/D114631

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114504: [clang][DebugInfo] Debug support for private variables inside an OpenMP task construct

2021-11-25 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro accepted this revision.
djtodoro added a comment.
This revision is now accepted and ready to land.

LGTM


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114504/new/

https://reviews.llvm.org/D114504

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114504: [clang][DebugInfo] Debug support for private variables inside an OpenMP task construct

2021-11-25 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

This looks reasonable to me (some nits included).




Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:4513
 Scope.addPrivate(Pair.first, [Replacement]() { return Replacement; });
+if (auto *DI = CGF.getDebugInfo()) {
+  DI->EmitDeclareOfAutoVariable(Pair.first, Pair.second.getPointer(),

I think we can get rid of curly brackets.



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:4515
+  DI->EmitDeclareOfAutoVariable(Pair.first, Pair.second.getPointer(),
+CGF.Builder, true);
+}




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114504/new/

https://reviews.llvm.org/D114504

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114504: [clang][DebugInfo] Debug support for private variables inside an OpenMP task construct

2021-11-24 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Thanks for doing this! Can you please update the summary, since it hard to read 
with the format like this (at least, just try to reformat the debugger output 
properly with the Phabricator formatters)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114504/new/

https://reviews.llvm.org/D114504

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D111521: [DebugInfo] Mark OpenMP generated functions as artificial

2021-10-11 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

This looks reasonable to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111521/new/

https://reviews.llvm.org/D111521

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108618: [CGCall] Add NoInline attr if presented for the target

2021-08-27 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro abandoned this revision.
djtodoro added a comment.

In D108618#2968626 , @rjmccall wrote:

> Does LLVM model `noinline` as a call-site attribute in the way that would be 
> necessary to get that effect?  Also, are you actually having a problem here, 
> or is this just something you noticed in the code?

It is being ignored completely, anyway :/ I am not having a problem, actually. 
It has been noticed accidentally when looking at some other attribute, but then 
I've started playing with some Debug Info cases (since that is the area I 
mostly work) by dancing around with some cross CU referencing during when using 
LTO -- all in all, this isn't necessary.

> I'm not sure we can warn about putting the attribute on a declaration; it's 
> presumably still picked up by later definitions.  There's probably a warning 
> if they conflict, as they would if the first declaration was in a header 
> included in both places, which is best practice.

Oh yes... It is very hard to warn during compilation since we don't have the 
definition -- even though we have conflicts in `test-1.c` and `test-2.c`.

@rjmccall Thanks for your comments anyway :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108618/new/

https://reviews.llvm.org/D108618

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108618: [CGCall] Add NoInline attr if presented for the target

2021-08-26 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D108618#2964265 , @rjmccall wrote:

> Why do you want to add `noinline` to a function declaration that lacks a 
> definition?

If this won't be used at all I guess the compiler should throw a warning at 
least.
One example comes to my mind, and it includes LTO (and cross-compile unit 
inlining).

  $ cat test-1.c
  extern int __attribute__((noinline)) bar(void);
  
  int foo() {
  int v1 = bar();
  if (v1 > 100)
return 0;
  v1--;
  return v1;
  }
  
  $ cat $ cat test-2.c
  int __attribute__((always_inline)) bar(void);
  
  int foo2() {
  int v2 = bar();   
  if (v2 > 1000)
return 0;
  v2++;
  return v2;
  }
  
  $ cat test.c
  #include 
  
  extern int foo();
  extern int foo2();
  
  int bar() {
  int x;
  scanf("%d", );
  ++x;
  return x;
  }
  
  
  int main()
  {
  int i = foo();
  int j = foo2();
  return i - j;
  }
  
  $ clang test.c -g -S -flto -emit-llvm
  $ clang test-1.c -g -S -flto -emit-llvm
  $ clang test-2.c -g -S -flto -emit-llvm
  
  $ llvm-link -S -o linked.ll test-1.ll test-2.ll test.ll
  $ opt -S -O1 linked.ll -o optimized.ll

Having these simple compile units, I can expect that compiler is able to inline 
the `bar()` into `foo2()` but not into `foo()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108618/new/

https://reviews.llvm.org/D108618

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108618: [CGCall] Add NoInline attr if presented for the target

2021-08-24 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro created this revision.
djtodoro added a reviewer: rjmccall.
djtodoro added projects: clang, LLVM.
djtodoro requested review of this revision.

The `CodeGen` is missing to add the `NoInline` attribute to the target of a 
call, even the declaration has the __attribute__ presented. This fixes it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108618

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGClass.cpp
  clang/test/CodeGen/noinline-attr-on-target.c


Index: clang/test/CodeGen/noinline-attr-on-target.c
===
--- /dev/null
+++ clang/test/CodeGen/noinline-attr-on-target.c
@@ -0,0 +1,13 @@
+// Make sure the `noinline` attribute has been attached to the `bar()`.
+
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define dso_local void @foo() #[[#ATTR0:]] {
+// CHECK: declare void @bar() #[[#ATTR1:]]
+// CHECK: attributes #[[#ATTR0]] = { noinline
+// CHECK: attributes #[[#ATTR1]] = { noinline
+
+extern void __attribute__((noinline)) bar(void);
+void foo() {
+  bar();
+}
Index: clang/lib/CodeGen/CGClass.cpp
===
--- clang/lib/CodeGen/CGClass.cpp
+++ clang/lib/CodeGen/CGClass.cpp
@@ -1535,8 +1535,11 @@
 }
 // -fapple-kext must inline any call to this dtor into
 // the caller's body.
-if (getLangOpts().AppleKext)
+if (getLangOpts().AppleKext) {
+  if (CurFn->hasFnAttribute(llvm::Attribute::NoInline))
+CurFn->removeFnAttr(llvm::Attribute::NoInline);
   CurFn->addFnAttr(llvm::Attribute::AlwaysInline);
+}
 
 break;
   }
Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -2043,6 +2043,9 @@
 if (TargetDecl->hasAttr())
   FuncAttrs.addAttribute(llvm::Attribute::Convergent);
 
+if (!AttrOnCallSite && TargetDecl->hasAttr())
+  FuncAttrs.addAttribute(llvm::Attribute::NoInline);
+
 if (const FunctionDecl *Fn = dyn_cast(TargetDecl)) {
   AddAttributesFromFunctionProtoType(
   getContext(), FuncAttrs, Fn->getType()->getAs());


Index: clang/test/CodeGen/noinline-attr-on-target.c
===
--- /dev/null
+++ clang/test/CodeGen/noinline-attr-on-target.c
@@ -0,0 +1,13 @@
+// Make sure the `noinline` attribute has been attached to the `bar()`.
+
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: define dso_local void @foo() #[[#ATTR0:]] {
+// CHECK: declare void @bar() #[[#ATTR1:]]
+// CHECK: attributes #[[#ATTR0]] = { noinline
+// CHECK: attributes #[[#ATTR1]] = { noinline
+
+extern void __attribute__((noinline)) bar(void);
+void foo() {
+  bar();
+}
Index: clang/lib/CodeGen/CGClass.cpp
===
--- clang/lib/CodeGen/CGClass.cpp
+++ clang/lib/CodeGen/CGClass.cpp
@@ -1535,8 +1535,11 @@
 }
 // -fapple-kext must inline any call to this dtor into
 // the caller's body.
-if (getLangOpts().AppleKext)
+if (getLangOpts().AppleKext) {
+  if (CurFn->hasFnAttribute(llvm::Attribute::NoInline))
+CurFn->removeFnAttr(llvm::Attribute::NoInline);
   CurFn->addFnAttr(llvm::Attribute::AlwaysInline);
+}
 
 break;
   }
Index: clang/lib/CodeGen/CGCall.cpp
===
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -2043,6 +2043,9 @@
 if (TargetDecl->hasAttr())
   FuncAttrs.addAttribute(llvm::Attribute::Convergent);
 
+if (!AttrOnCallSite && TargetDecl->hasAttr())
+  FuncAttrs.addAttribute(llvm::Attribute::NoInline);
+
 if (const FunctionDecl *Fn = dyn_cast(TargetDecl)) {
   AddAttributesFromFunctionProtoType(
   getContext(), FuncAttrs, Fn->getType()->getAs());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99160: [X86][FastISEL] Support DW_TAG_call_site_parameter with FastISEL

2021-04-06 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D99160#2669576 , @dblaikie wrote:

> In D99160#2668977 , @djtodoro wrote:
>
>> I think that the Debug Entry Values feature should not be enabled by default 
>> for non optimized code, so the `TargetOptions::ShouldEmitDebugEntryValues()` 
>> should be patched with checking of optimization level (it should be > 0).
>
> That's currently intended to be already handled by the frontend, right? 
> (clang only sets `EnableDebugEntryValues` (which `ShouldEmitDebugEntryValues` 
> checks (hmm, it checks under 'or', not 'and', so I'm not sure where the "only 
> above -O0" is implemented, but it is implemented somewhere?) if optimizations 
> are enabled, yeah?)
>
> Oh, is entry_values actually not conditionalized? It's only the call_site 
> support that's currently conditionalized on "above -O0"?

Looks like there is no explicit check of optimization level (above "-O0"), 
neither on frontend nor backend for entry-values generation. I think it is the 
situation since there should not be any optimization (at least that I am aware 
of, in the case of C/C++) that would cause the entry-values generation...

> Hmm - If that's the case, and we currently have some cases where entry_values 
> are emitted at -O0, I'm not sure /not/ emitting those is the right call 
> either. If we believe/have data to show that there are so few useful uses of 
> entry_value at -O0 that it's not worth the DWARF size growth to put 
> call_sites in at -O0, then I think it might still be worth leaving the 
> entry_values in (unless they take up a bunch of extra space) for the cases of 
> mixed optimization compilation (-O0 some code you're debugging, but building 
> the rest with optimizations).

Yeah... That is valuable example... I am thinking in that direction as well, 
and I am closer to the enabling it for -O0 case if that is useful (and there is 
no dramatic cost in terms of DWARF size).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99160/new/

https://reviews.llvm.org/D99160

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99160: [X86][FastISEL] Support DW_TAG_call_site_parameter with FastISEL

2021-04-05 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

I think that the Debug Entry Values feature should not be enabled by default 
for non optimized code, so the `TargetOptions::ShouldEmitDebugEntryValues()` 
should be patched with checking of optimization level (it should be > 0).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99160/new/

https://reviews.llvm.org/D99160

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99160: [X86][FastISEL] Support DW_TAG_call_site_parameter with FastISEL

2021-04-02 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D99160#2666104 , @alok wrote:

> In D99160#2666068 , @djtodoro wrote:
>
>> In D99160#2666066 , @alok wrote:
>>
>>> In D99160#2665580 , @probinson 
>>> wrote:
>>>
 FastISel is normally used only at -O0, I wouldn't expect any parameters to 
 be optimized out at -O0.
 The test is running llc with default optimization, which is -O2, and 
 forcing fast-isel; this is not a usual combination and I wouldn't expect 
 us to spend any effort making sure debug info works well with that 
 combination.

 If flang is forcing fast-isel even with optimization, that sounds like a 
 problem for flang to solve, not LLVM.
>>>
>>> Thanks for your comments. I am sorry as the earlier used options in test 
>>> case were more confusing than helpful. I have changed that now.
>>> The updated testcase at "-O0" with FastISel does have optimized out 
>>> parameter, this is because generation of "DW_OP_GNU_entry_value" is enabled 
>>> starting from "-O0". This causes llvm to generate it whenever it gets 
>>> opportunity (more local variables to preserve may be the reason). 
>>> The concern here is only DW_OP_GNU_entry_value is not sufficient and should 
>>> be supported with "DW_TAG_GNU_call_site_parameter", which I tried in 
>>> current patch.
>>
>>
>>
>>> "DW_OP_GNU_entry_value" is enabled starting from "-O0".
>>
>> I am wondering if this is true...
>
> You can try with testcase attached with this patch.
>
> bash$ llc -O0 -filetype=obj llvm/test/DebugInfo/X86/callsitepar-fastisel.ll 
> -o callsitepar-fastisel.o
> bash$ llvm-dwarfdump callsitepar-fastisel.o | grep DW_OP_GNU_entry_value
>
>   [0x00bf, 0x0101): DW_OP_GNU_entry_value(DW_OP_reg4 
> RSI))

OK, thanks! We should fix that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99160/new/

https://reviews.llvm.org/D99160

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99160: [X86][FastISEL] Support DW_TAG_call_site_parameter with FastISEL

2021-04-02 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D99160#2666066 , @alok wrote:

> In D99160#2665580 , @probinson wrote:
>
>> FastISel is normally used only at -O0, I wouldn't expect any parameters to 
>> be optimized out at -O0.
>> The test is running llc with default optimization, which is -O2, and forcing 
>> fast-isel; this is not a usual combination and I wouldn't expect us to spend 
>> any effort making sure debug info works well with that combination.
>>
>> If flang is forcing fast-isel even with optimization, that sounds like a 
>> problem for flang to solve, not LLVM.
>
> Thanks for your comments. I am sorry as the earlier used options in test case 
> were more confusing than helpful. I have changed that now.
> The updated testcase at "-O0" with FastISel does have optimized out 
> parameter, this is because generation of "DW_OP_GNU_entry_value" is enabled 
> starting from "-O0". This causes llvm to generate it whenever it gets 
> opportunity (more local variables to preserve may be the reason). 
> The concern here is only DW_OP_GNU_entry_value is not sufficient and should 
> be supported with "DW_TAG_GNU_call_site_parameter", which I tried in current 
> patch.



> "DW_OP_GNU_entry_value" is enabled starting from "-O0".

I am wondering if this is true...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99160/new/

https://reviews.llvm.org/D99160

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose original debug info preservation check as CC1 option

2021-03-25 Thread Djordje Todorovic via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8420a5332486: [Debugify] Expose original debug info 
preservation check as CC1 option (authored by djtodoro).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/verify-debug-info-preservation.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -376,6 +376,17 @@
 
   $ llvm-original-di-preservation.py sample.json sample.html
 
+Testing of original debug info preservation can be invoked from front-end level
+as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fverify-debuginfo-preserve -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fverify-debuginfo-preserve -Xclang -fverify-debuginfo-preserve-export=sample.json -g -O2 sample.c
+
 Mutation testing for MIR-level transformations
 --
 
Index: clang/test/Driver/verify-debug-info-preservation.c
===
--- /dev/null
+++ clang/test/Driver/verify-debug-info-preservation.c
@@ -0,0 +1,19 @@
+// We support the CC1 options for testing whether each LLVM pass preserves
+// original debug info.
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE %s
+
+// VERIFYDIPRESERVE: "-fverify-debuginfo-preserve"
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve \
+// RUN: -Xclang -fverify-debuginfo-preserve-export=%t.json -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE-JSON-EXPORT %s
+
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve"
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve-export={{.*}}"
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve-export=%t.json %s -S 2>&1 \
+// RUN: | FileCheck --check-prefix=WARN %s
+
+// WARN: warning: ignoring -fverify-debuginfo-preserve-export
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1648,6 +1648,12 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  if (!Opts.EnableDIPreservationVerify && Opts.DIBugsReportFilePath.size()) {
+Diags.Report(diag::warn_ignoring_verify_debuginfo_preserve_export)
+<< Opts.DIBugsReportFilePath;
+Opts.DIBugsReportFilePath = "";
+  }
+
   Opts.NewStructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa) &&
Args.hasArg(OPT_new_struct_path_tbaa);
   Opts.OptimizeSize = getOptimizationLevelSize(Args);
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -81,6 +81,7 @@
 #include "llvm/Transforms/Scalar/LowerMatrixIntrinsics.h"
 #include "llvm/Transforms/Utils.h"
 #include "llvm/Transforms/Utils/CanonicalizeAliases.h"
+#include "llvm/Transforms/Utils/Debugify.h"
 #include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
 #include "llvm/Transforms/Utils/SymbolRewriter.h"
@@ -945,7 +946,16 @@
   if (TM)
 TheModule->setDataLayout(TM->createDataLayout());
 
-  legacy::PassManager PerModulePasses;
+  DebugifyCustomPassManager PerModulePasses;
+  DebugInfoPerPassMap DIPreservationMap;
+  if (CodeGenOpts.EnableDIPreservationVerify) {
+PerModulePasses.setDebugifyMode(DebugifyMode::OriginalDebugInfo);
+PerModulePasses.setDIPreservationMap(DIPreservationMap);
+
+if (!CodeGenOpts.DIBugsReportFilePath.empty())
+  PerModulePasses.setOrigDIVerifyBugsReportFilePath(
+  CodeGenOpts.DIBugsReportFilePath);
+  }
   PerModulePasses.add(
   createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -4877,6 +4877,18 @@
 "fexperimental-debug-variable-locations">,
 HelpText<"Use experimental new value-tracking variable locations">,
 MarshallingInfoFlag>;
+def fverify_debuginfo_preserve
+: Flag<["-"], 

[PATCH] D82547: [Debugify] Expose original debug info preservation check as CC1 option

2021-03-25 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose original debug info preservation check as CC1 option

2021-03-24 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Thanks.

I feel like this is ready to go. Any additional comment?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99238: [DebugInfo] Enable the call site parameter feature by default

2021-03-24 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added inline comments.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1645
 
-  if (Opts.OptimizationLevel > 0 && Opts.hasReducedDebugInfo() &&
+  if (Opts.hasReducedDebugInfo() &&
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))

I am a bit confused now :)
Is `flang` using this clang's library?
I think we should be careful here, since I am not sure C/C++ -O0 code has any 
benefits of using this, but the DWARF size might be increased insanely.



Comment at: llvm/test/DebugInfo/X86/callsitepar-fastisel.ll:12
 
+;; This test checks if DW_TAG_GNU_call_site_parameter is generated for option 
-O0
+;RUN: clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj  -main-file-name 
%s -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -O0 -x ir %s 
-o - | llvm-dwarfdump - | FileCheck %s --check-prefix=CLANG

I don't think this should be tested this way. We should be testing `Driver` 
itself.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99238/new/

https://reviews.llvm.org/D99238

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose original debug info preservation check as CC1 option

2021-03-23 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 332679.
djtodoro added a comment.

- addressing comments


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/verify-debug-info-preservation.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -376,6 +376,17 @@
 
   $ llvm-original-di-preservation.py sample.json sample.html
 
+Testing of original debug info preservation can be invoked from front-end level
+as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fverify-debuginfo-preserve -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fverify-debuginfo-preserve -Xclang -fverify-debuginfo-preserve-export=sample.json -g -O2 sample.c
+
 Mutation testing for MIR-level transformations
 --
 
Index: clang/test/Driver/verify-debug-info-preservation.c
===
--- /dev/null
+++ clang/test/Driver/verify-debug-info-preservation.c
@@ -0,0 +1,19 @@
+// We support the CC1 options for testing whether each LLVM pass preserves
+// original debug info.
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE %s
+
+// VERIFYDIPRESERVE: "-fverify-debuginfo-preserve"
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve \
+// RUN: -Xclang -fverify-debuginfo-preserve-export=%t.json -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE-JSON-EXPORT %s
+
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve"
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve-export={{.*}}"
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve-export=%t.json %s -S 2>&1 \
+// RUN: | FileCheck --check-prefix=WARN %s
+
+// WARN: warning: ignoring -fverify-debuginfo-preserve-export
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1641,6 +1641,12 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  if (!Opts.EnableDIPreservationVerify && Opts.DIBugsReportFilePath.size()) {
+Diags.Report(diag::warn_ignoring_verify_debuginfo_preserve_export)
+<< Opts.DIBugsReportFilePath;
+Opts.DIBugsReportFilePath = "";
+  }
+
   Opts.NewStructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa) &&
Args.hasArg(OPT_new_struct_path_tbaa);
   Opts.OptimizeSize = getOptimizationLevelSize(Args);
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -81,6 +81,7 @@
 #include "llvm/Transforms/Scalar/LowerMatrixIntrinsics.h"
 #include "llvm/Transforms/Utils.h"
 #include "llvm/Transforms/Utils/CanonicalizeAliases.h"
+#include "llvm/Transforms/Utils/Debugify.h"
 #include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
 #include "llvm/Transforms/Utils/SymbolRewriter.h"
@@ -945,7 +946,16 @@
   if (TM)
 TheModule->setDataLayout(TM->createDataLayout());
 
-  legacy::PassManager PerModulePasses;
+  DebugifyCustomPassManager PerModulePasses;
+  DebugInfoPerPassMap DIPreservationMap;
+  if (CodeGenOpts.EnableDIPreservationVerify) {
+PerModulePasses.setDebugifyMode(DebugifyMode::OriginalDebugInfo);
+PerModulePasses.setDIPreservationMap(DIPreservationMap);
+
+if (!CodeGenOpts.DIBugsReportFilePath.empty())
+  PerModulePasses.setOrigDIVerifyBugsReportFilePath(
+  CodeGenOpts.DIBugsReportFilePath);
+  }
   PerModulePasses.add(
   createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -4865,6 +4865,18 @@
 "fexperimental-debug-variable-locations">,
 HelpText<"Use experimental new value-tracking variable locations">,
 MarshallingInfoFlag>;
+def fverify_debuginfo_preserve
+: Flag<["-"], "fverify-debuginfo-preserve">,
+  HelpText<"Enable Debug Info Metadata preservation testing in "
+   "optimizations.">,
+  MarshallingInfoFlag>;
+def fverify_debuginfo_preserve_export
+: Joined<["-"], 

[PATCH] D82547: [Debugify] Expose original debug info preservation check as CC1 option

2021-03-23 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added inline comments.



Comment at: clang/include/clang/Driver/Options.td:4872
+   "optimizations.">;
+def fverify_debuginfo_preserve_export
+: Joined<["-"], "fverify-debuginfo-preserve-export=">,

jansvoboda11 wrote:
> Please, update the new options to use the marshalling infrastructure. You can 
> then remove the code from `CompilerInvocation`.
> 
> https://clang.llvm.org/docs/InternalsManual.html#adding-new-command-line-option
Sure. Thanks!



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1644-1650
+  Opts.EnableDIPreservationVerify = 
Args.hasArg(OPT_fverify_debuginfo_preserve);
+  // Ignore the option if the -fverify-debuginfo-preserve wasn't enabled.
+  if (Opts.EnableDIPreservationVerify &&
+  Args.hasArg(OPT_fverify_debuginfo_preserve_export)) {
+Opts.DIBugsReportFilePath = std::string(
+Args.getLastArgValue(OPT_fverify_debuginfo_preserve_export));
+  }

StephenTozer wrote:
> Any particular behaviour if the user specifies a file for 
> `-fverify-debuginfo-preserve-export` but doesn't set 
> `-fverify-debuginfo-preserve`? It seems like it would be worth emitting a 
> warning in this case, though I'm not sure if that's an established precedent.
it makes sense


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99160: [X86][FastISEL] Support DW_TAG_call_site_parameter with FastISEL

2021-03-23 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Cool -- thanks for working on this!




Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1645
 
-  if (Opts.OptimizationLevel > 0 && Opts.hasReducedDebugInfo() &&
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))

I think this should be a different patch.

Are you saying this is useful for some -O0 cases? Can you please provide a test 
case? Is this related to Fortran only?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99160/new/

https://reviews.llvm.org/D99160

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose original debug info preservation check as CC1 option

2021-03-22 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Ping.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose original debug info preservation check as CC1 option

2021-03-11 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 329972.
djtodoro added a comment.

- rebase on top of trunk
- refactor the code

ping :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/verify-debug-info-preservation.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -376,6 +376,17 @@
 
   $ llvm-original-di-preservation.py sample.json sample.html
 
+Testing of original debug info preservation can be invoked from front-end level
+as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fverify-debuginfo-preserve -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fverify-debuginfo-preserve -Xclang -fverify-debuginfo-preserve-export=sample.json -g -O2 sample.c
+
 Mutation testing for MIR-level transformations
 --
 
Index: clang/test/Driver/verify-debug-info-preservation.c
===
--- /dev/null
+++ clang/test/Driver/verify-debug-info-preservation.c
@@ -0,0 +1,14 @@
+// We support the CC1 options for testing whether each LLVM pass preserves
+// original debug info.
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE %s
+
+// VERIFYDIPRESERVE: "-fverify-debuginfo-preserve"
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve \
+// RUN: -Xclang -fverify-debuginfo-preserve-export=%t.json -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE-JSON-EXPORT %s
+
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve"
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve-export={{.*}}"
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1641,6 +1641,14 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDIPreservationVerify = Args.hasArg(OPT_fverify_debuginfo_preserve);
+  // Ignore the option if the -fverify-debuginfo-preserve wasn't enabled.
+  if (Opts.EnableDIPreservationVerify &&
+  Args.hasArg(OPT_fverify_debuginfo_preserve_export)) {
+Opts.DIBugsReportFilePath = std::string(
+Args.getLastArgValue(OPT_fverify_debuginfo_preserve_export));
+  }
+
   Opts.NewStructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa) &&
Args.hasArg(OPT_new_struct_path_tbaa);
   Opts.OptimizeSize = getOptimizationLevelSize(Args);
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -81,6 +81,7 @@
 #include "llvm/Transforms/Scalar/LowerMatrixIntrinsics.h"
 #include "llvm/Transforms/Utils.h"
 #include "llvm/Transforms/Utils/CanonicalizeAliases.h"
+#include "llvm/Transforms/Utils/Debugify.h"
 #include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
 #include "llvm/Transforms/Utils/SymbolRewriter.h"
@@ -945,7 +946,16 @@
   if (TM)
 TheModule->setDataLayout(TM->createDataLayout());
 
-  legacy::PassManager PerModulePasses;
+  DebugifyCustomPassManager PerModulePasses;
+  DebugInfoPerPassMap DIPreservationMap;
+  if (CodeGenOpts.EnableDIPreservationVerify) {
+PerModulePasses.setDebugifyMode(DebugifyMode::OriginalDebugInfo);
+PerModulePasses.setDIPreservationMap(DIPreservationMap);
+
+if (!CodeGenOpts.DIBugsReportFilePath.empty())
+  PerModulePasses.setOrigDIVerifyBugsReportFilePath(
+  CodeGenOpts.DIBugsReportFilePath);
+  }
   PerModulePasses.add(
   createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -4865,6 +4865,16 @@
 "fexperimental-debug-variable-locations">,
 HelpText<"Use experimental new value-tracking variable locations">,
 MarshallingInfoFlag>;
+def fverify_debuginfo_preserve
+: Flag<["-"], "fverify-debuginfo-preserve">,
+  HelpText<"Enable Debug Info Metadata preservation testing in "
+   "optimizations.">;
+def fverify_debuginfo_preserve_export
+: Joined<["-"], "fverify-debuginfo-preserve-export=">,
+  MetaVarName<"">,
+  HelpText<"Export debug info 

[PATCH] D82547: [Debugify] Expose original debug info preservation check as CC1 option

2021-02-26 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Ping :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose original debug info preservation check as CC1 option

2021-02-24 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 326005.
djtodoro retitled this revision from "[VerifyDIPreserve] Expose original 
debuginfo preservation check as CC1 option" to "[Debugify] Expose original 
debug info preservation check as CC1 option".
djtodoro added a comment.
Herald added subscribers: jansvoboda11, dexonsmith.

- Rebase on top of trunk


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/verify-debug-info-preservation.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -376,6 +376,17 @@
 
   $ llvm-original-di-preservation.py sample.json sample.html
 
+Testing of original debug info preservation can be invoked from front-end level
+as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fverify-debuginfo-preserve -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fverify-debuginfo-preserve -Xclang -fverify-debuginfo-preserve-export=sample.json -g -O2 sample.c
+
 Mutation testing for MIR-level transformations
 --
 
Index: clang/test/Driver/verify-debug-info-preservation.c
===
--- /dev/null
+++ clang/test/Driver/verify-debug-info-preservation.c
@@ -0,0 +1,14 @@
+// We support the CC1 options for testing whether each LLVM pass preserves
+// original debug info.
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE %s
+
+// VERIFYDIPRESERVE: "-fverify-debuginfo-preserve"
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve \
+// RUN: -Xclang -fverify-debuginfo-preserve-export=%t.json -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE-JSON-EXPORT %s
+
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve"
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve-export={{.*}}"
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1634,6 +1634,16 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDIPreservationVerify =
+  Args.hasArg(OPT_fverify_debuginfo_preserve);
+  // Ignore the option if the -fverify-debuginfo-preserve wasn't enabled.
+  if (Opts.EnableDIPreservationVerify &&
+  Args.hasArg(OPT_fverify_debuginfo_preserve_export)) {
+ Opts.DIBugsReportFilePath =
+  std::string(
+  Args.getLastArgValue(OPT_fverify_debuginfo_preserve_export));
+  }
+
   Opts.NewStructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa) &&
Args.hasArg(OPT_new_struct_path_tbaa);
   Opts.OptimizeSize = getOptimizationLevelSize(Args);
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -85,6 +85,7 @@
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
 #include "llvm/Transforms/Utils/SymbolRewriter.h"
 #include "llvm/Transforms/Utils/UniqueInternalLinkageNames.h"
+#include "llvm/Transforms/Utils/Debugify.h"
 #include 
 using namespace clang;
 using namespace llvm;
@@ -926,7 +927,17 @@
   if (TM)
 TheModule->setDataLayout(TM->createDataLayout());
 
-  legacy::PassManager PerModulePasses;
+  DebugifyCustomPassManager PerModulePasses;
+  DebugInfoPerPassMap DIPreservationMap;
+  if (CodeGenOpts.EnableDIPreservationVerify) {
+PerModulePasses.setDebugifyMode(
+DebugifyMode::OriginalDebugInfo);
+PerModulePasses.setDIPreservationMap(DIPreservationMap);
+
+if (!CodeGenOpts.DIBugsReportFilePath.empty())
+  PerModulePasses.setOrigDIVerifyBugsReportFilePath(
+  CodeGenOpts.DIBugsReportFilePath);
+  }
   PerModulePasses.add(
   createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -4788,6 +4788,16 @@
 "fexperimental-debug-variable-locations">,
 HelpText<"Use experimental new value-tracking variable locations">,
 MarshallingInfoFlag>;
+def fverify_debuginfo_preserve
+: Flag<["-"], "fverify-debuginfo-preserve">,
+  HelpText<"Enable Debug Info Metadata preservation testing in "
+   

[PATCH] D82547: [VerifyDIPreserve] Expose original debuginfo preservation check as CC1 option

2020-09-28 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 294658.
djtodoro added a comment.

-Rebasing


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/verify-debug-info-preservation.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -317,6 +317,16 @@
 
   $ llvm-original-di-preservation.py sample.json sample.html
 
+The `original-di-check` mode can be invoked from front-end level as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fverify-debuginfo-preserve -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fverify-debuginfo-preserve -Xclang -fverify-debuginfo-preserve-export=sample.json -g -O2 sample.c
+
 Using ``VerifyDIPreserve``
 ^^
 
Index: clang/test/Driver/verify-debug-info-preservation.c
===
--- /dev/null
+++ clang/test/Driver/verify-debug-info-preservation.c
@@ -0,0 +1,14 @@
+// We support the CC1 options for testing whether each LLVM pass preserves
+// original debug info.
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE %s
+
+// VERIFYDIPRESERVE: "-fverify-debuginfo-preserve"
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve \
+// RUN: -Xclang -fverify-debuginfo-preserve-export=%t.json -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE-JSON-EXPORT %s
+
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve"
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve-export={{.*}}"
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -835,6 +835,16 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDIPreservationVerify =
+  Args.hasArg(OPT_fverify_debuginfo_preserve);
+  // Ignore the option if the -fverify-debuginfo-preserve wasn't enabled.
+  if (Opts.EnableDIPreservationVerify &&
+  Args.hasArg(OPT_fverify_debuginfo_preserve_export)) {
+ Opts.DIBugsReportFilePath =
+  std::string(
+  Args.getLastArgValue(OPT_fverify_debuginfo_preserve_export));
+  }
+
   Opts.ValueTrackingVariableLocations =
   Args.hasArg(OPT_fexperimental_debug_variable_locations);
 
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -82,6 +82,7 @@
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
 #include "llvm/Transforms/Utils/SymbolRewriter.h"
 #include "llvm/Transforms/Utils/UniqueInternalLinkageNames.h"
+#include "llvm/Transforms/Utils/VerifyDIPreserve.h"
 #include 
 using namespace clang;
 using namespace llvm;
@@ -894,7 +895,17 @@
   if (TM)
 TheModule->setDataLayout(TM->createDataLayout());
 
-  legacy::PassManager PerModulePasses;
+  VerifyDIPreserveCustomPassManager PerModulePasses;
+  DebugInfoPerPassMap DIPreservationMap;
+  if (CodeGenOpts.EnableDIPreservationVerify) {
+PerModulePasses.setVerifyDIPreserveMode(
+VerifyDIPreserveMode::OriginalDebugInfo);
+PerModulePasses.setDIPreservationMap(DIPreservationMap);
+
+if (!CodeGenOpts.DIBugsReportFilePath.empty())
+  PerModulePasses.setOrigDIVerifyBugsReportFilePath(
+  CodeGenOpts.DIBugsReportFilePath);
+  }
   PerModulePasses.add(
   createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -3911,6 +3911,16 @@
 def fexperimental_debug_variable_locations : Flag<["-"],
 "fexperimental-debug-variable-locations">,
 HelpText<"Use experimental new value-tracking variable locations">;
+def fverify_debuginfo_preserve
+: Flag<["-"], "fverify-debuginfo-preserve">,
+  HelpText<"Enable Debug Info Metadata preservation testing in "
+   "optimizations.">;
+def fverify_debuginfo_preserve_export
+: Joined<["-"], "fverify-debuginfo-preserve-export=">,
+  MetaVarName<"">,
+  HelpText<"Export debug info (by testing original Debug Info) failures "
+   "into specified (JSON) file (should be abs path as we use "
+   "append mode to insert new JSON 

[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-09-17 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 292469.
djtodoro added a comment.

- Rebasing


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/verify-debug-info-preservation.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -317,6 +317,16 @@
 
   $ llvm-original-di-preservation.py sample.json sample.html
 
+The `original-di-check` mode can be invoked from front-end level as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fverify-debuginfo-preserve -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fverify-debuginfo-preserve -Xclang -fverify-debuginfo-preserve-export=sample.json -g -O2 sample.c
+
 Using ``VerifyDIPreserve``
 ^^
 
Index: clang/test/Driver/verify-debug-info-preservation.c
===
--- /dev/null
+++ clang/test/Driver/verify-debug-info-preservation.c
@@ -0,0 +1,14 @@
+// We support the CC1 options for testing whether each LLVM pass preserves
+// original debug info.
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE %s
+
+// VERIFYDIPRESERVE: "-fverify-debuginfo-preserve"
+
+// RUN: %clang -g -Xclang -fverify-debuginfo-preserve \
+// RUN: -Xclang -fverify-debuginfo-preserve-export=%t.json -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=VERIFYDIPRESERVE-JSON-EXPORT %s
+
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve"
+// VERIFYDIPRESERVE-JSON-EXPORT: "-fverify-debuginfo-preserve-export={{.*}}"
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -835,6 +835,16 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDIPreservationVerify =
+  Args.hasArg(OPT_fverify_debuginfo_preserve);
+  // Ignore the option if the -fverify-debuginfo-preserve wasn't enabled.
+  if (Opts.EnableDIPreservationVerify &&
+  Args.hasArg(OPT_fverify_debuginfo_preserve_export)) {
+ Opts.DIBugsReportFilePath =
+  std::string(
+  Args.getLastArgValue(OPT_fverify_debuginfo_preserve_export));
+  }
+
   Opts.ValueTrackingVariableLocations =
   Args.hasArg(OPT_fexperimental_debug_variable_locations);
 
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -82,6 +82,7 @@
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
 #include "llvm/Transforms/Utils/SymbolRewriter.h"
 #include "llvm/Transforms/Utils/UniqueInternalLinkageNames.h"
+#include "llvm/Transforms/Utils/VerifyDIPreserve.h"
 #include 
 using namespace clang;
 using namespace llvm;
@@ -893,7 +894,17 @@
   if (TM)
 TheModule->setDataLayout(TM->createDataLayout());
 
-  legacy::PassManager PerModulePasses;
+  VerifyDIPreserveCustomPassManager PerModulePasses;
+  DebugInfoPerPassMap DIPreservationMap;
+  if (CodeGenOpts.EnableDIPreservationVerify) {
+PerModulePasses.setVerifyDIPreserveMode(
+VerifyDIPreserveMode::OriginalDebugInfo);
+PerModulePasses.setDIPreservationMap(DIPreservationMap);
+
+if (!CodeGenOpts.DIBugsReportFilePath.empty())
+  PerModulePasses.setOrigDIVerifyBugsReportFilePath(
+  CodeGenOpts.DIBugsReportFilePath);
+  }
   PerModulePasses.add(
   createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -3894,6 +3894,16 @@
 def fexperimental_debug_variable_locations : Flag<["-"],
 "fexperimental-debug-variable-locations">,
 HelpText<"Use experimental new value-tracking variable locations">;
+def fverify_debuginfo_preserve
+: Flag<["-"], "fverify-debuginfo-preserve">,
+  HelpText<"Enable Debug Info Metadata preservation testing in "
+   "optimizations.">;
+def fverify_debuginfo_preserve_export
+: Joined<["-"], "fverify-debuginfo-preserve-export=">,
+  MetaVarName<"">,
+  HelpText<"Export debug info (by testing original Debug Info) failures "
+   "into specified (JSON) file (should be abs path as we use "
+   "append mode to insert new JSON 

[PATCH] D83048: [LiveDebugValues] 3/4 Add Xclang and CodeGen options for using instr-ref variable locations

2020-08-24 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro accepted this revision.
djtodoro added a comment.
This revision is now accepted and ready to land.

nit included, otherwise lgtm, thanks!




Comment at: llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp:45
+  ~LiveDebugValues()
+  {
+if (TheImpl)

is this clang-formatted?




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83048/new/

https://reviews.llvm.org/D83048

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-07-14 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 277781.
djtodoro added a comment.
Herald added a subscriber: dang.

- Rebase


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/debugify-each-original.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -317,6 +317,16 @@
 
   $ llvm-debugify-original.py sample.json sample.html
 
+The `original` mode can be invoked from front-end level as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fenable-debugify-each-original -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fenable-debugify-each-original -Xclang -fenable-debugify-original-export=sample.json -g -O2 sample.c
+
 Using ``debugify``
 ^^
 
Index: clang/test/Driver/debugify-each-original.c
===
--- /dev/null
+++ clang/test/Driver/debugify-each-original.c
@@ -0,0 +1,14 @@
+// We support the CC1 options for testing whether each LLVM pass preserves
+// original debug info.
+
+// RUN: %clang -g -Xclang -fenable-debugify-each-original -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DEBUGIFY %s
+
+// DEBUGIFY: "-fenable-debugify-each-original"
+
+// RUN: %clang -g -Xclang -fenable-debugify-each-original \
+// RUN: -Xclang -fenable-debugify-original-export=%t.json -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DEBUGIFY-JSON-EXPORT %s
+
+// DEBUGIFY-JSON-EXPORT: "-fenable-debugify-each-original"
+// DEBUGIFY-JSON-EXPORT: "-fenable-debugify-original-export={{.*}}"
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -791,6 +791,16 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDebugifyEachOriginal =
+  Args.hasArg(OPT_fenable_debugify_each_original);
+  // Ignore the option if the -fenable-debugify-each-original wasn't enabled.
+  if (Opts.EnableDebugifyEachOriginal &&
+  Args.hasArg(OPT_fenable_debugify_original_export)) {
+  Opts.DIBugsReportFilePath =
+  std::string(
+  Args.getLastArgValue(OPT_fenable_debugify_original_export));
+  }
+
   Opts.DisableO0ImplyOptNone = Args.hasArg(OPT_disable_O0_optnone);
   Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
   Opts.IndirectTlsSegRefs = Args.hasArg(OPT_mno_tls_direct_seg_refs);
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -76,6 +76,7 @@
 #include "llvm/Transforms/Scalar/GVN.h"
 #include "llvm/Transforms/Utils.h"
 #include "llvm/Transforms/Utils/CanonicalizeAliases.h"
+#include "llvm/Transforms/Utils/Debugify.h"
 #include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
 #include "llvm/Transforms/Utils/SymbolRewriter.h"
@@ -867,7 +868,14 @@
   if (TM)
 TheModule->setDataLayout(TM->createDataLayout());
 
-  legacy::PassManager PerModulePasses;
+  DebugifyCustomPassManager PerModulePasses;
+  if (CodeGenOpts.EnableDebugifyEachOriginal) {
+PerModulePasses.enableDebugifyEachOriginal();
+
+if (!CodeGenOpts.DIBugsReportFilePath.empty())
+  PerModulePasses.setDebugifyOriginalBugsReportFilePath(
+  CodeGenOpts.DIBugsReportFilePath);
+  }
   PerModulePasses.add(
   createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
 
Index: clang/include/clang/Driver/CC1Options.td
===
--- clang/include/clang/Driver/CC1Options.td
+++ clang/include/clang/Driver/CC1Options.td
@@ -389,6 +389,16 @@
 HelpText<"Prints debug information for the new pass manager">;
 def fno_debug_pass_manager : Flag<["-"], "fno-debug-pass-manager">,
 HelpText<"Disables debug printing for the new pass manager">;
+def fenable_debugify_each_original
+: Flag<["-"], "fenable-debugify-each-original">,
+  HelpText<"Enable Debug Info Metadata preservation testing in "
+   "optimizations.">;
+def fenable_debugify_original_export
+: Joined<["-"], "fenable-debugify-original-export=">,
+  MetaVarName<"">,
+  HelpText<"Export debugify (by testing original Debug Info) failures into "
+   "specified (JSON) file (should be abs path as we use "
+   "append mode to insert new JSON 

[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-07-08 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 276398.
djtodoro added a comment.

- Rebase on top of D83391 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/debugify-each-original.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -317,6 +317,16 @@
 
   $ llvm-debugify-original.py sample.json sample.html
 
+The `original` mode can be invoked from front-end level as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fenable-debugify-each-original -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fenable-debugify-each-original -Xclang -fenable-debugify-original-export=sample.json -g -O2 sample.c
+
 Using ``debugify``
 ^^
 
Index: clang/test/Driver/debugify-each-original.c
===
--- /dev/null
+++ clang/test/Driver/debugify-each-original.c
@@ -0,0 +1,14 @@
+// We support the CC1 options for testing whether each LLVM pass preserves
+// original debug info.
+
+// RUN: %clang -g -Xclang -fenable-debugify-each-original -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DEBUGIFY %s
+
+// DEBUGIFY: "-fenable-debugify-each-original"
+
+// RUN: %clang -g -Xclang -fenable-debugify-each-original \
+// RUN: -Xclang -fenable-debugify-original-export=%t.json -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DEBUGIFY-JSON-EXPORT %s
+
+// DEBUGIFY-JSON-EXPORT: "-fenable-debugify-each-original"
+// DEBUGIFY-JSON-EXPORT: "-fenable-debugify-original-export={{.*}}"
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -791,6 +791,16 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDebugifyEachOriginal =
+  Args.hasArg(OPT_fenable_debugify_each_original);
+  // Ignore the option if the -fenable-debugify-each-original wasn't enabled.
+  if (Opts.EnableDebugifyEachOriginal &&
+  Args.hasArg(OPT_fenable_debugify_original_export)) {
+  Opts.DIBugsReportFilePath =
+  std::string(
+  Args.getLastArgValue(OPT_fenable_debugify_original_export));
+  }
+
   Opts.DisableO0ImplyOptNone = Args.hasArg(OPT_disable_O0_optnone);
   Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
   Opts.IndirectTlsSegRefs = Args.hasArg(OPT_mno_tls_direct_seg_refs);
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -76,6 +76,7 @@
 #include "llvm/Transforms/Scalar/GVN.h"
 #include "llvm/Transforms/Utils.h"
 #include "llvm/Transforms/Utils/CanonicalizeAliases.h"
+#include "llvm/Transforms/Utils/Debugify.h"
 #include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
 #include "llvm/Transforms/Utils/SymbolRewriter.h"
@@ -867,7 +868,14 @@
   if (TM)
 TheModule->setDataLayout(TM->createDataLayout());
 
-  legacy::PassManager PerModulePasses;
+  llvm::legacy::DebugifyCustomPassManager PerModulePasses;
+  if (CodeGenOpts.EnableDebugifyEachOriginal) {
+PerModulePasses.enableDebugifyEachOriginal();
+
+if (!CodeGenOpts.DIBugsReportFilePath.empty())
+  PerModulePasses.setDebugifyOriginalBugsReportFilePath(
+  CodeGenOpts.DIBugsReportFilePath);
+  }
   PerModulePasses.add(
   createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
 
Index: clang/include/clang/Driver/CC1Options.td
===
--- clang/include/clang/Driver/CC1Options.td
+++ clang/include/clang/Driver/CC1Options.td
@@ -389,6 +389,16 @@
 HelpText<"Prints debug information for the new pass manager">;
 def fno_debug_pass_manager : Flag<["-"], "fno-debug-pass-manager">,
 HelpText<"Disables debug printing for the new pass manager">;
+def fenable_debugify_each_original
+: Flag<["-"], "fenable-debugify-each-original">,
+  HelpText<"Enable Debug Info Metadata preservation testing in "
+   "optimizations.">;
+def fenable_debugify_original_export
+: Joined<["-"], "fenable-debugify-original-export=">,
+  MetaVarName<"">,
+  HelpText<"Export debugify (by testing original Debug Info) failures into "
+   "specified (JSON) file (should be abs path as we use "
+   

[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-07-08 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro marked an inline comment as done.
djtodoro added inline comments.



Comment at: clang/lib/CodeGen/BackendUtil.cpp:855
 
+class ClangCustomPassManager : public legacy::PassManager {
+public:

djtodoro wrote:
> vsk wrote:
> > Please factor out OptCustomPassManager from opt and generalize it so it can 
> > be used by both opt and clang. That should help ensure that extensions and 
> > bug fixes are only made to one custom 'debugify' pass manager.
> I'll try that with the latest code. I remember I've tried it once, but I 
> ended up moving it into the IR library (since we need to link it within 
> legacy pass manager).
Hi @vsk, I've posted the patch as D83391. Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-07-06 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro marked 2 inline comments as done.
djtodoro added inline comments.



Comment at: clang/lib/CodeGen/BackendUtil.cpp:855
 
+class ClangCustomPassManager : public legacy::PassManager {
+public:

vsk wrote:
> Please factor out OptCustomPassManager from opt and generalize it so it can 
> be used by both opt and clang. That should help ensure that extensions and 
> bug fixes are only made to one custom 'debugify' pass manager.
I'll try that with the latest code. I remember I've tried it once, but I ended 
up moving it into the IR library (since we need to link it within legacy pass 
manager).



Comment at: clang/lib/CodeGen/BackendUtil.cpp:893
+
+  void enableDebugifyEachOriginal() { DebugifyEachOriginalEnabled = true; }
+

vsk wrote:
> I don't think the discussion from 'RFC: Introduce LLVM DI Checker utility' is 
> complete, and I'd ask that you split off changes for 'original mode' from 
> this patch until there's some consensus about what that mode should look like.
> 
> There are open questions about to what extent a new mode is needed (e.g., it 
> may be that the interesting questions compiler developers need to answer 
> about debug info loss are simpler to determine some other way (which is not 
> to say that that's true -- just that we haven't explored the space much 
> yet)). Or what its output should look like.
OK, I'll split off this and notify you/resend a message on the RFC.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D83048: [LiveDebugValues] 3/4 Add Xclang and CodeGen options for using instr-ref variable locations

2020-07-02 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Please add a test case for the Driver option (you can take a look into existing 
ones within `clang/test/Driver/`).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83048/new/

https://reviews.llvm.org/D83048



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-07-01 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro marked an inline comment as done.
djtodoro added inline comments.



Comment at: clang/test/Driver/debugify-each-original.c:9
+
+// RUN: rm -rf %t.json
+// RUN: %clang -g -Xclang -fenable-debugify-each-original \

aprantl wrote:
> I think this is redundant?
It is, thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-07-01 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 274690.
djtodoro added a comment.

- Remove redundant line from the test


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/debugify-each-original.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -317,6 +317,16 @@
 
   $ llvm-debugify-original.py sample.json sample.html
 
+The `original` mode can be invoked from front-end level as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fenable-debugify-each-original -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fenable-debugify-each-original -Xclang -fenable-debugify-original-export=sample.json -g -O2 sample.c
+
 Using ``debugify``
 ^^
 
Index: clang/test/Driver/debugify-each-original.c
===
--- /dev/null
+++ clang/test/Driver/debugify-each-original.c
@@ -0,0 +1,14 @@
+// We support the CC1 options for testing whether each LLVM pass preserves
+// original debug info.
+
+// RUN: %clang -g -Xclang -fenable-debugify-each-original -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DEBUGIFY %s
+
+// DEBUGIFY: "-fenable-debugify-each-original"
+
+// RUN: %clang -g -Xclang -fenable-debugify-each-original \
+// RUN: -Xclang -fenable-debugify-original-export=%t.json -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DEBUGIFY-JSON-EXPORT %s
+
+// DEBUGIFY-JSON-EXPORT: "-fenable-debugify-each-original"
+// DEBUGIFY-JSON-EXPORT: "-fenable-debugify-original-export={{.*}}"
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -791,6 +791,16 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDebugifyEachOriginal =
+  Args.hasArg(OPT_fenable_debugify_each_original);
+  // Ignore the option if the -fenable-debugify-each-original wasn't enabled.
+  if (Opts.EnableDebugifyEachOriginal &&
+  Args.hasArg(OPT_fenable_debugify_original_export)) {
+  Opts.DIOriginalBugsReportFilePath =
+  std::string(
+  Args.getLastArgValue(OPT_fenable_debugify_original_export));
+  }
+
   Opts.DisableO0ImplyOptNone = Args.hasArg(OPT_disable_O0_optnone);
   Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
   Opts.IndirectTlsSegRefs = Args.hasArg(OPT_mno_tls_direct_seg_refs);
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -76,6 +76,7 @@
 #include "llvm/Transforms/Scalar/GVN.h"
 #include "llvm/Transforms/Utils.h"
 #include "llvm/Transforms/Utils/CanonicalizeAliases.h"
+#include "llvm/Transforms/Utils/Debugify.h"
 #include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
 #include "llvm/Transforms/Utils/SymbolRewriter.h"
@@ -851,6 +852,61 @@
   return true;
 }
 
+class ClangCustomPassManager : public legacy::PassManager {
+public:
+  void add(Pass *P) override {
+bool WrapWithDebugifyOriginal = DebugifyEachOriginalEnabled &&
+!P->getAsImmutablePass() &&
+!isIRPrintingPass(P);
+if (!WrapWithDebugifyOriginal) {
+  PassManager::add(P);
+  return;
+}
+
+PassKind Kind = P->getPassKind();
+StringRef Name = P->getPassName();
+
+// TODO: Implement Debugify for LoopPass.
+switch (Kind) {
+case PT_Function:
+  PassManager::add(createDebugifyFunctionPass(
+  DebugifyMode::OriginalDebugInfo, Name, ));
+  PassManager::add(P);
+  PassManager::add(createCheckDebugifyFunctionPass(
+  false, Name, nullptr, DebugifyMode::OriginalDebugInfo,
+  , getDebugifyEachOriginalPath()));
+  break;
+case PT_Module:
+  PassManager::add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo,
+Name, ));
+  PassManager::add(P);
+  PassManager::add(createCheckDebugifyModulePass(
+  false, Name, nullptr, DebugifyMode::OriginalDebugInfo,
+  , getDebugifyEachOriginalPath()));
+  break;
+default:
+  PassManager::add(P);
+  break;
+}
+  }
+
+  void enableDebugifyEachOriginal() { DebugifyEachOriginalEnabled = true; }
+
+  void
+  setDIOriginalBugsReportFilePath(StringRef 

[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-06-30 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 274433.
djtodoro added a comment.

- Add the Driver test
- Remove the old high level test in order to avoid troubles when someone 
updates an LLVM pass with the impact on Debugify output (e.g. a new debug info 
bugs)
- clang-formatted


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/debugify-each-original.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -317,6 +317,16 @@
 
   $ llvm-debugify-original.py sample.json sample.html
 
+The `original` mode can be invoked from front-end level as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fenable-debugify-each-original -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fenable-debugify-each-original -Xclang -fenable-debugify-original-export=sample.json -g -O2 sample.c
+
 Using ``debugify``
 ^^
 
Index: clang/test/Driver/debugify-each-original.c
===
--- /dev/null
+++ clang/test/Driver/debugify-each-original.c
@@ -0,0 +1,15 @@
+// We support the CC1 options for testing whether each LLVM pass preserves
+// original debug info.
+
+// RUN: %clang -g -Xclang -fenable-debugify-each-original -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DEBUGIFY %s
+
+// DEBUGIFY: "-fenable-debugify-each-original"
+
+// RUN: rm -rf %t.json
+// RUN: %clang -g -Xclang -fenable-debugify-each-original \
+// RUN: -Xclang -fenable-debugify-original-export=%t.json -### %s 2>&1 \
+// RUN: | FileCheck --check-prefix=DEBUGIFY-JSON-EXPORT %s
+
+// DEBUGIFY-JSON-EXPORT: "-fenable-debugify-each-original"
+// DEBUGIFY-JSON-EXPORT: "-fenable-debugify-original-export={{.*}}"
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -791,6 +791,16 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDebugifyEachOriginal =
+  Args.hasArg(OPT_fenable_debugify_each_original);
+  // Ignore the option if the -fenable-debugify-each-original wasn't enabled.
+  if (Opts.EnableDebugifyEachOriginal &&
+  Args.hasArg(OPT_fenable_debugify_original_export)) {
+  Opts.DIOriginalBugsReportFilePath =
+  std::string(
+  Args.getLastArgValue(OPT_fenable_debugify_original_export));
+  }
+
   Opts.DisableO0ImplyOptNone = Args.hasArg(OPT_disable_O0_optnone);
   Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
   Opts.IndirectTlsSegRefs = Args.hasArg(OPT_mno_tls_direct_seg_refs);
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -76,6 +76,7 @@
 #include "llvm/Transforms/Scalar/GVN.h"
 #include "llvm/Transforms/Utils.h"
 #include "llvm/Transforms/Utils/CanonicalizeAliases.h"
+#include "llvm/Transforms/Utils/Debugify.h"
 #include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
 #include "llvm/Transforms/Utils/NameAnonGlobals.h"
 #include "llvm/Transforms/Utils/SymbolRewriter.h"
@@ -851,6 +852,61 @@
   return true;
 }
 
+class ClangCustomPassManager : public legacy::PassManager {
+public:
+  void add(Pass *P) override {
+bool WrapWithDebugifyOriginal = DebugifyEachOriginalEnabled &&
+!P->getAsImmutablePass() &&
+!isIRPrintingPass(P);
+if (!WrapWithDebugifyOriginal) {
+  PassManager::add(P);
+  return;
+}
+
+PassKind Kind = P->getPassKind();
+StringRef Name = P->getPassName();
+
+// TODO: Implement Debugify for LoopPass.
+switch (Kind) {
+case PT_Function:
+  PassManager::add(createDebugifyFunctionPass(
+  DebugifyMode::OriginalDebugInfo, Name, ));
+  PassManager::add(P);
+  PassManager::add(createCheckDebugifyFunctionPass(
+  false, Name, nullptr, DebugifyMode::OriginalDebugInfo,
+  , getDebugifyEachOriginalPath()));
+  break;
+case PT_Module:
+  PassManager::add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo,
+Name, ));
+  PassManager::add(P);
+  PassManager::add(createCheckDebugifyModulePass(
+  false, Name, nullptr, DebugifyMode::OriginalDebugInfo,
+  , getDebugifyEachOriginalPath()));
+  break;
+default:
+ 

[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-06-30 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro marked an inline comment as done.
djtodoro added inline comments.



Comment at: clang/test/DebugInfo/debugify-each-original.c:16
+// CHECK: Force set function attributes: {{.*}}
+// CHECK-NEXT: Infer set function attributes: {{.*}}
+// CHECK-NEXT: Interprocedural Sparse Conditional Constant Propagation: {{.*}}

aprantl wrote:
> I think this is still implicitly hardcoding the pass pipeline just through 
> the order of CHECK lines. If there were a way to dump the flags Clang is 
> passing to LLVM and check that, or get the pass manager to dump its 
> configuration, that would be better. I'm not sure if there is such an 
> affordance.
I see... It is hard to test it that way, but as far as I can see, it is enough 
to test only the `Driver` in situations like this, so I am adding a new test 
case and getting rid of this one.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-06-29 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro marked an inline comment as done.
djtodoro added inline comments.



Comment at: clang/test/DebugInfo/debugify-each-original.c:57
+// CHECK-NEXT: Hoist/decompose integer division and remainder: PASS
+// CHECK-NEXT: Simplify the CFG: PASS

aprantl wrote:
> aprantl wrote:
> > We probably shouldn't check the effects of LLVM passes in the Clang test 
> > suite. When someone breaks one of those LLVM passes and that shouldn't 
> > cause an error in the Clang *frontend* test suite. It's sufficient to check 
> > that the pass is passed on to LLVM here. The operation of it should be 
> > checked either in LLVM or in an end-to-end test, e.g., inside 
> > debug-info-tests.
> I probably should emphasize that an end-to-end test will probably just cause 
> us trouble: Someone will make an unrelated change to a pass, that pushes a 
> subsequent pass into a behavior that doesn't pass the debugify verifier, and 
> now the author of the unrelated patch is on the hook to fix that other pass. 
> I think that will make everyone unhappy. Maybe it should be treated more like 
> the debug info statistics?
@aprantl Thanks for your comments!

I agree with this... I refactored the test a bit, please take look.

>Maybe it should be treated more like the debug info statistics?
The final goal of this is to be used either from the python script that should 
process the JSON objects (shared within previous patch), or the JSON objects 
could be used from 
http://green.lab.llvm.org/green/view/LLDB/job/clang-3.4-debuginfo-statistics/ 
as well with some additional (groovy) scripts.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-06-29 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 274054.
djtodoro added a comment.

-Update the test


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82547/new/

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/DebugInfo/debugify-each-original.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -317,6 +317,16 @@
 
   $ llvm-debugify-original.py sample.json sample.html
 
+The `original` mode can be invoked from front-end level as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fenable-debugify-each-original -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fenable-debugify-each-original -Xclang -fenable-debugify-original-export=sample.json -g -O2 sample.c
+
 Using ``debugify``
 ^^
 
Index: clang/test/DebugInfo/debugify-each-original.c
===
--- /dev/null
+++ clang/test/DebugInfo/debugify-each-original.c
@@ -0,0 +1,61 @@
+// Ensure that we tested each pass with the feature, but we do not
+// check the final result here. It is up to LLVM test suite to check the real
+// logic of the functionality.
+
+// RUN: %clang -g -Xclang -fenable-debugify-each-original -emit-llvm -S \
+// RUN: -O1 -o - %s 2>&1 | FileCheck %s
+
+int main()
+{
+  int x = 1;
+  int y = 2;
+  return x + y;
+}
+
+// CHECK: Force set function attributes: {{.*}}
+// CHECK-NEXT: Infer set function attributes: {{.*}}
+// CHECK-NEXT: Interprocedural Sparse Conditional Constant Propagation: {{.*}}
+// CHECK-NEXT: Called Value Propagation: {{.*}}
+// CHECK-NEXT: Global Variable Optimizer: {{.*}}
+// CHECK-NEXT: Promote Memory to Register: {{.*}}
+// CHECK-NEXT: Dead Argument Elimination: {{.*}}
+// CHECK-NEXT: Combine redundant instructions: {{.*}}
+// CHECK-NEXT: Simplify the CFG: {{.*}}
+// CHECK-NEXT: Globals Alias Analysis: {{.*}}
+// CHECK-NEXT: SROA: {{.*}}
+// CHECK-NEXT: Early CSE w/ MemorySSA: {{.*}}
+// CHECK-NEXT: Simplify the CFG: {{.*}}
+// CHECK-NEXT: Combine redundant instructions: {{.*}}
+// CHECK-NEXT: Conditionally eliminate dead library calls: {{.*}}
+// CHECK-NEXT: PGOMemOPSize: {{.*}}
+// CHECK-NEXT: Simplify the CFG: {{.*}}
+// CHECK-NEXT: Reassociate expressions: {{.*}}
+// CHECK-NEXT: Simplify the CFG: {{.*}}
+// CHECK-NEXT: Combine redundant instructions: {{.*}}
+// CHECK-NEXT: MemCpy Optimization: {{.*}}
+// CHECK-NEXT: Sparse Conditional Constant Propagation: {{.*}}
+// CHECK-NEXT: Bit-Tracking Dead Code Elimination: {{.*}}
+// CHECK-NEXT: Combine redundant instructions: {{.*}}
+// CHECK-NEXT: Aggressive Dead Code Elimination: {{.*}}
+// CHECK-NEXT: Simplify the CFG: {{.*}}
+// CHECK-NEXT: Combine redundant instructions: {{.*}}
+// CHECK-NEXT: A No-Op Barrier {{.*}}: {{.*}}
+// CHECK-NEXT: Deduce function attributes in RPO: {{.*}}
+// CHECK-NEXT: Global Variable Optimizer: {{.*}}
+// CHECK-NEXT: Dead Global Elimination: {{.*}}
+// CHECK-NEXT: Globals Alias Analysis: {{.*}}
+// CHECK-NEXT: Float to int: {{.*}}
+// CHECK-NEXT: Lower constant intrinsics: {{.*}}
+// CHECK-NEXT: Loop Distribution: {{.*}}
+// CHECK-NEXT: Loop Vectorization: {{.*}}
+// CHECK-NEXT: Loop Load Elimination: {{.*}}
+// CHECK-NEXT: Combine redundant instructions: {{.*}}
+// CHECK-NEXT: Simplify the CFG: {{.*}}
+// CHECK-NEXT: Optimize scalar/vector ops: {{.*}}
+// CHECK-NEXT: Combine redundant instructions: {{.*}}
+// CHECK-NEXT: Warn about non-applied transformations: {{.*}}
+// CHECK-NEXT: Alignment from assumptions: {{.*}}
+// CHECK-NEXT: Strip Unused Function Prototypes: {{.*}}
+// CHECK-NEXT: Remove redundant instructions: {{.*}}
+// CHECK-NEXT: Hoist/decompose integer division and remainder: {{.*}}
+// CHECK-NEXT: Simplify the CFG: {{.*}}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -791,6 +791,16 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDebugifyEachOriginal =
+  Args.hasArg(OPT_fenable_debugify_each_original);
+  // Ignore the option if the -fenable-debugify-each-original wasn't enabled.
+  if (Opts.EnableDebugifyEachOriginal &&
+  Args.hasArg(OPT_fenable_debugify_original_export)) {
+  Opts.DIOriginalBugsReportFilePath =
+  std::string(
+  Args.getLastArgValue(OPT_fenable_debugify_original_export));
+  }
+
   Opts.DisableO0ImplyOptNone = Args.hasArg(OPT_disable_O0_optnone);
   Opts.DisableRedZone = 

[PATCH] D82547: [Debugify] Expose debugify (original mode) as CC1 option

2020-06-25 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro created this revision.
djtodoro added reviewers: vsk, aprantl, dblaikie, probinson.
djtodoro added projects: debug-info, LLVM.
Herald added a project: clang.
Herald added subscribers: llvm-commits, cfe-commits.
djtodoro added a parent revision: D82546: [Debugify][OriginalMode] Export the 
report into JSON file.

In order to test the preservation of the original Debug Info metadata in your 
projects, a front end option could be very useful, since users usually report 
that a concrete entity (e.g. variable `x`, or function `fn2()`) is missing 
debug info. The [0] is an example of running the utility on GDB Project.

[0] https://djolertrk.github.io/di-checker-html-report-example/


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82547

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/DebugInfo/debugify-each-original.c
  llvm/docs/HowToUpdateDebugInfo.rst

Index: llvm/docs/HowToUpdateDebugInfo.rst
===
--- llvm/docs/HowToUpdateDebugInfo.rst
+++ llvm/docs/HowToUpdateDebugInfo.rst
@@ -317,6 +317,16 @@
 
   $ llvm-debugify-original.py sample.json sample.html
 
+The `original` mode can be invoked from front-end level as follows:
+
+.. code-block:: bash
+
+  # Test each pass.
+  $ clang -Xclang -fenable-debugify-each-original -g -O2 sample.c
+
+  # Test each pass and export the issues report into the JSON file.
+  $ clang -Xclang -fenable-debugify-each-original -Xclang -fenable-debugify-original-export=sample.json -g -O2 sample.c
+
 Using ``debugify``
 ^^
 
Index: clang/test/DebugInfo/debugify-each-original.c
===
--- /dev/null
+++ clang/test/DebugInfo/debugify-each-original.c
@@ -0,0 +1,57 @@
+// RUN: %clang -g -Xclang -fenable-debugify-each-original -emit-llvm -S \
+// RUN: -O1 -o - %s 2>&1 | FileCheck %s
+
+int main()
+{
+  int x = 1;
+  int y = 2;
+  return x + y;
+}
+
+// CHECK: Force set function attributes: PASS
+// CHECK-NEXT: Infer set function attributes: PASS
+// CHECK-NEXT: Interprocedural Sparse Conditional Constant Propagation: PASS
+// CHECK-NEXT: Called Value Propagation: PASS
+// CHECK-NEXT: Global Variable Optimizer: PASS
+// CHECK-NEXT: Promote Memory to Register: PASS
+// CHECK-NEXT: Dead Argument Elimination: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Globals Alias Analysis: PASS
+// CHECK-NEXT: SROA: PASS
+// CHECK-NEXT: Early CSE w/ MemorySSA: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: Conditionally eliminate dead library calls: PASS
+// CHECK-NEXT: PGOMemOPSize: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Reassociate expressions: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: MemCpy Optimization: PASS
+// CHECK-NEXT: Sparse Conditional Constant Propagation: PASS
+// CHECK-NEXT: Bit-Tracking Dead Code Elimination: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: Aggressive Dead Code Elimination: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: A No-Op Barrier Pass: PASS
+// CHECK-NEXT: Deduce function attributes in RPO: PASS
+// CHECK-NEXT: Global Variable Optimizer: PASS
+// CHECK-NEXT: Dead Global Elimination: PASS
+// CHECK-NEXT: Globals Alias Analysis: PASS
+// CHECK-NEXT: Float to int: PASS
+// CHECK-NEXT: Lower constant intrinsics: PASS
+// CHECK-NEXT: Loop Distribution: PASS
+// CHECK-NEXT: Loop Vectorization: PASS
+// CHECK-NEXT: Loop Load Elimination: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
+// CHECK-NEXT: Optimize scalar/vector ops: PASS
+// CHECK-NEXT: Combine redundant instructions: PASS
+// CHECK-NEXT: Warn about non-applied transformations: PASS
+// CHECK-NEXT: Alignment from assumptions: PASS
+// CHECK-NEXT: Strip Unused Function Prototypes: PASS
+// CHECK-NEXT: Remove redundant instructions: PASS
+// CHECK-NEXT: Hoist/decompose integer division and remainder: PASS
+// CHECK-NEXT: Simplify the CFG: PASS
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -791,6 +791,16 @@
   llvm::is_contained(DebugEntryValueArchs, T.getArch()))
 Opts.EmitCallSiteInfo = true;
 
+  Opts.EnableDebugifyEachOriginal =
+  Args.hasArg(OPT_fenable_debugify_each_original);
+  // Ignore the option if the -fenable-debugify-each-original wasn't enabled.
+  if (Opts.EnableDebugifyEachOriginal &&
+  

[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-06-01 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Thanks for the reviews!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80369/new/

https://reviews.llvm.org/D80369



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-06-01 Thread Djordje Todorovic via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG40a3fcb05c83: [DebugInfo][CallSites] Remove decl subprograms 
from retainedTypes: (authored by djtodoro).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80369/new/

https://reviews.llvm.org/D80369

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-extern-call.c
  clang/test/Modules/DebugInfoTransitiveImport.m
  clang/test/Modules/ModuleDebugInfo.cpp
  clang/test/Modules/ModuleDebugInfo.m

Index: clang/test/Modules/ModuleDebugInfo.m
===
--- clang/test/Modules/ModuleDebugInfo.m
+++ clang/test/Modules/ModuleDebugInfo.m
@@ -36,19 +36,13 @@
 // CHECK-NOT:  name:
 // CHECK-SAME: elements:
 
-// CHECK: !DISubprogram(name: "+[ObjCClass classMethod]",
-// CHECK-SAME:  scope: ![[MODULE]],
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
+// CHECK-SAME: scope: ![[MODULE]],
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MODULE]],
 // CHECK-SAME: elements
 
-// The forward declaration should not be in the module scope.
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file
-
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
-// CHECK-SAME: scope: ![[MODULE]],
-
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
 // CHECK-SAME: scope: ![[MODULE]],
 // CHECK-SAME: elements
@@ -85,11 +79,8 @@
 // The output order is sublty different for module vs. pch,
 // so these are checked separately:
 //
-// CHECK2: !DISubprogram(name: "+[ObjCClass classMethod]"
-// CHECK2: !DISubprogram(name: "-[ObjCClass instanceMethodWithInt:]"
+// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
 // CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK2: !DIObjCProperty(name: "property",
 // CHECK2: !DIDerivedType(tag: DW_TAG_member, name: "ivar"
-// CHECK2: !DISubprogram(name: "-[Category(Category) categoryMethod]"
-// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
 // CHECK2: !DIDerivedType(tag: DW_TAG_typedef, name: "InnerEnum"
Index: clang/test/Modules/ModuleDebugInfo.cpp
===
--- clang/test/Modules/ModuleDebugInfo.cpp
+++ clang/test/Modules/ModuleDebugInfo.cpp
@@ -51,15 +51,6 @@
 // CHECK-SAME: )
 // CHECK: !DIEnumerator(name: "e5", value: 5, isUnsigned: true)
 
-// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B",
-// no mangled name here yet.
-
-// This type is anchored by a function parameter.
-// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A"
-// CHECK-SAME: elements:
-// CHECK-SAME: templateParams:
-// CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE")
-
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Struct"
 // CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE")
 
@@ -85,6 +76,12 @@
 // CHECK-SAME: templateParams:
 // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIlNS_6traitsIl")
 
+// This type is anchored by a function parameter.
+// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A"
+// CHECK-SAME: elements:
+// CHECK-SAME: templateParams:
+// CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE")
+
 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstantiation"
 // no mangled name here yet.
 
@@ -93,6 +90,9 @@
 // CHECK-SAME: flags: DIFlagFwdDecl
 // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIf")
 
+// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B",
+// no mangled name here yet.
+
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Virtual"
 // CHECK-SAME: elements:
 // CHECK-SAME: identifier: "_ZTS7Virtual")
Index: clang/test/Modules/DebugInfoTransitiveImport.m
===
--- clang/test/Modules/DebugInfoTransitiveImport.m
+++ clang/test/Modules/DebugInfoTransitiveImport.m
@@ -12,10 +12,10 @@
 
 // Definition of left:
 // CHECK: !DICompileUnit({{.*}}dwoId:
-// CHECK: ![[LEFT:[0-9]+]] = !DIFile({{.*}}diamond_left.h
 // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration,
-// CHECK-SAME:  entity: ![[MODULE:.*]], file: ![[LEFT]], line: 3)
+// CHECK-SAME:  entity: ![[MODULE:.*]], file: ![[LEFT:.*]], line: 3)
 // CHECK: ![[MODULE]] = !DIModule(scope: null, name: "diamond_top"
+// CHECK: ![[LEFT]] = !DIFile({{.*}}diamond_left.h
 
 // Skeleton for top:
 // CHECK: !DICompileUnit({{.*}}splitDebugFilename: {{.*}}diamond_top{{.*}}dwoId:
Index: 

[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-05-29 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro marked an inline comment as done.
djtodoro added inline comments.



Comment at: clang/test/Modules/ModuleDebugInfo.m:46-47
 
-// The forward declaration should not be in the module scope.
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file
-

dblaikie wrote:
> Did this type go missing with this change? (ie: was this type /only/ 
> accessible via a subprogram in the retained types list?)
Yes, it was **only** accessible via that subprogram we removed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80369/new/

https://reviews.llvm.org/D80369



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-05-28 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 266776.
djtodoro added a comment.

-Tests clean up


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80369/new/

https://reviews.llvm.org/D80369

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-extern-call.c
  clang/test/Modules/DebugInfoTransitiveImport.m
  clang/test/Modules/ModuleDebugInfo.cpp
  clang/test/Modules/ModuleDebugInfo.m

Index: clang/test/Modules/ModuleDebugInfo.m
===
--- clang/test/Modules/ModuleDebugInfo.m
+++ clang/test/Modules/ModuleDebugInfo.m
@@ -36,19 +36,13 @@
 // CHECK-NOT:  name:
 // CHECK-SAME: elements:
 
-// CHECK: !DISubprogram(name: "+[ObjCClass classMethod]",
-// CHECK-SAME:  scope: ![[MODULE]],
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
+// CHECK-SAME: scope: ![[MODULE]],
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK-SAME: scope: ![[MODULE]],
 // CHECK-SAME: elements
 
-// The forward declaration should not be in the module scope.
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file
-
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
-// CHECK-SAME: scope: ![[MODULE]],
-
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
 // CHECK-SAME: scope: ![[MODULE]],
 // CHECK-SAME: elements
@@ -85,11 +79,8 @@
 // The output order is sublty different for module vs. pch,
 // so these are checked separately:
 //
-// CHECK2: !DISubprogram(name: "+[ObjCClass classMethod]"
-// CHECK2: !DISubprogram(name: "-[ObjCClass instanceMethodWithInt:]"
+// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
 // CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
 // CHECK2: !DIObjCProperty(name: "property",
 // CHECK2: !DIDerivedType(tag: DW_TAG_member, name: "ivar"
-// CHECK2: !DISubprogram(name: "-[Category(Category) categoryMethod]"
-// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
 // CHECK2: !DIDerivedType(tag: DW_TAG_typedef, name: "InnerEnum"
Index: clang/test/Modules/ModuleDebugInfo.cpp
===
--- clang/test/Modules/ModuleDebugInfo.cpp
+++ clang/test/Modules/ModuleDebugInfo.cpp
@@ -51,15 +51,6 @@
 // CHECK-SAME: )
 // CHECK: !DIEnumerator(name: "e5", value: 5, isUnsigned: true)
 
-// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B",
-// no mangled name here yet.
-
-// This type is anchored by a function parameter.
-// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A"
-// CHECK-SAME: elements:
-// CHECK-SAME: templateParams:
-// CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE")
-
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Struct"
 // CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE")
 
@@ -85,6 +76,12 @@
 // CHECK-SAME: templateParams:
 // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIlNS_6traitsIl")
 
+// This type is anchored by a function parameter.
+// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A"
+// CHECK-SAME: elements:
+// CHECK-SAME: templateParams:
+// CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE")
+
 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstantiation"
 // no mangled name here yet.
 
@@ -93,6 +90,9 @@
 // CHECK-SAME: flags: DIFlagFwdDecl
 // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIf")
 
+// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B",
+// no mangled name here yet.
+
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Virtual"
 // CHECK-SAME: elements:
 // CHECK-SAME: identifier: "_ZTS7Virtual")
Index: clang/test/Modules/DebugInfoTransitiveImport.m
===
--- clang/test/Modules/DebugInfoTransitiveImport.m
+++ clang/test/Modules/DebugInfoTransitiveImport.m
@@ -12,10 +12,10 @@
 
 // Definition of left:
 // CHECK: !DICompileUnit({{.*}}dwoId:
-// CHECK: ![[LEFT:[0-9]+]] = !DIFile({{.*}}diamond_left.h
 // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration,
-// CHECK-SAME:  entity: ![[MODULE:.*]], file: ![[LEFT]], line: 3)
+// CHECK-SAME:  entity: ![[MODULE:.*]], file: ![[LEFT:.*]], line: 3)
 // CHECK: ![[MODULE]] = !DIModule(scope: null, name: "diamond_top"
+// CHECK: ![[LEFT]] = !DIFile({{.*}}diamond_left.h
 
 // Skeleton for top:
 // CHECK: !DICompileUnit({{.*}}splitDebugFilename: {{.*}}diamond_top{{.*}}dwoId:
Index: clang/test/CodeGen/debug-info-extern-call.c
===
--- clang/test/CodeGen/debug-info-extern-call.c
+++ 

[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-05-28 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D80369#2057866 , @dblaikie wrote:

> Not sure I follow - why was it a problem that there was no DISubprogram at 
> all?


Actually, since the DISubprograms from the retained types don't affect the 
final DWARF, it's not a problem at all. :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80369/new/

https://reviews.llvm.org/D80369



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-05-27 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

>> @dblaikie wrote:
> 
> ... At least for the C++ test, this change makes it pass:
> 
>   diff --git clang/test/Modules/ModuleDebugInfo.cpp 
> clang/test/Modules/ModuleDebugInfo.cpp
>   index 26369c89605..b1ffe27ec22 100644
>   --- clang/test/Modules/ModuleDebugInfo.cpp
>   +++ clang/test/Modules/ModuleDebugInfo.cpp
>   @@ -51,15 +51,6 @@
>// CHECK-SAME: )
>// CHECK: !DIEnumerator(name: "e5", value: 5, isUnsigned: true)
>
>   -// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B",
>   -// no mangled name here yet.
>   -
>   -// This type is anchored by a function parameter.
>   -// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A"
>   -// CHECK-SAME: elements:
>   -// CHECK-SAME: templateParams:
>   -// CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE")
>   -
>// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Struct"
>// CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE")
>
>   @@ -85,6 +76,12 @@
>// CHECK-SAME: templateParams:
>// CHECK-SAME: identifier: 
> "_ZTSN8DebugCXX8TemplateIlNS_6traitsIl")
>
>   +// This type is anchored by a function parameter.
>   +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A"
>   +// CHECK-SAME: elements:
>   +// CHECK-SAME: templateParams:
>   +// CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE")
>   +
>// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstantiation"
>// no mangled name here yet.
>
>   @@ -93,6 +90,9 @@
>// CHECK-SAME: flags: DIFlagFwdDecl
>// CHECK-SAME: identifier: 
> "_ZTSN8DebugCXX8TemplateIfNS_6traitsIf")
>
>   +// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B",
>   +// no mangled name here yet.
>   +
>// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Virtual"
>// CHECK-SAME: elements:
>// CHECK-SAME: identifier: "_ZTS7Virtual")

I've also faced this scenario, but the problem was with the 
`Modules/ModuleDebugInfo.m` (Objective-C) test, since after applying previous 
version of the patch [0] (plus refacotred Modules/DebugInfoTransitiveImport.m & 
Modules/ModuleDebugInfo.cpp) there wasn't any `DISubprogram` at all, and that 
was the reason I made this version of the patch.

[0]: F12010783: debuginfo-remove-decls-from-ret-types.patch 



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80369/new/

https://reviews.llvm.org/D80369



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-05-22 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D80369#2050022 , @dblaikie wrote:

> In D80369#2048932 , @djtodoro wrote:
>
> > Still have test failing:
> >
> >   Clang :: Modules/DebugInfoTransitiveImport.m
> >   Clang :: Modules/ModuleDebugInfo.cpp
> >   Clang :: Modules/ModuleDebugInfo.m
> >   
> >
> > I haven't looked into the failures, but I guess something Objective-C++ 
> > related should be handled with some additional work here.
>
>
> These look like over-constrained/accidental tests. At least the 
> ModuleDEbugInfo.m test - the type being tested for won't be emitted, because 
> the type itself isn't in the retained types list nor is it reachable from any 
> other metadata that is going to be emitted.
>
> I think it'd probably be good to clean these tests up - and leave it to 
> @aprantl to look into if this has exposed other bugs - but the bugs are 
> already there, and this IR/debug info metadata isn't working around the bugs, 
> since the IR is going unused anyway.


Looks like ObjC expects the declarations within retained types  (based on some 
tests failures), so I left it as is (I think @aprantl can help us with that).
Therefore, this patch will remove the declarations only in the case of call 
site debug info for now.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80369/new/

https://reviews.llvm.org/D80369



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80369: [DebugInfo][CallSites] Remove decl subprograms from 'retainedTypes:'

2020-05-22 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 265722.
djtodoro retitled this revision from "WIP: [DebugInfo] Remove decl subprograms 
from 'retainedTypes:'" to "[DebugInfo][CallSites] Remove decl subprograms from 
'retainedTypes:'".
djtodoro added a comment.

-Remove the decls only in the case of call-site debug info


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80369/new/

https://reviews.llvm.org/D80369

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-extern-call.c


Index: clang/test/CodeGen/debug-info-extern-call.c
===
--- clang/test/CodeGen/debug-info-extern-call.c
+++ clang/test/CodeGen/debug-info-extern-call.c
@@ -1,6 +1,10 @@
 // When entry values are emitted, expect a subprogram for extern decls so that
 // the dwarf generator can describe call site parameters at extern call sites.
 //
+// Initial implementation relied on the 'retainedTypes:' from the corresponding
+// DICompileUnit, so we also ensure that we do not store the extern declaration
+// subprogram into the 'retainedTypes:'.
+//
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
 // RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
 
@@ -17,6 +21,8 @@
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o 
- \
 // RUN:   | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN
 
+// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: 
![[RETTYPES:[0-9]+]]
+// DECLS-FOR-EXTERN-NOT: ![[RETTYPES]] = !{
 // DECLS-FOR-EXTERN: !DISubprogram(name: "fn1"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3868,10 +3868,14 @@
   getOrCreateFunctionType(D, FnType, Unit), ScopeLine, Flags, SPFlags,
   TParamsArray.get(), getFunctionDeclaration(D));
 
-  if (IsDeclForCallSite)
-Fn->setSubprogram(SP);
+  // ObjC expects declarations within retained types.
+  if (!IsDeclForCallSite) {
+DBuilder.retainType(SP);
+return;
+  }
 
-  DBuilder.retainType(SP);
+  Fn->setSubprogram(SP);
+  DBuilder.finalizeSubprogram(SP);
 }
 
 void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,


Index: clang/test/CodeGen/debug-info-extern-call.c
===
--- clang/test/CodeGen/debug-info-extern-call.c
+++ clang/test/CodeGen/debug-info-extern-call.c
@@ -1,6 +1,10 @@
 // When entry values are emitted, expect a subprogram for extern decls so that
 // the dwarf generator can describe call site parameters at extern call sites.
 //
+// Initial implementation relied on the 'retainedTypes:' from the corresponding
+// DICompileUnit, so we also ensure that we do not store the extern declaration
+// subprogram into the 'retainedTypes:'.
+//
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
 // RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
 
@@ -17,6 +21,8 @@
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o - \
 // RUN:   | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN
 
+// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: ![[RETTYPES:[0-9]+]]
+// DECLS-FOR-EXTERN-NOT: ![[RETTYPES]] = !{
 // DECLS-FOR-EXTERN: !DISubprogram(name: "fn1"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3868,10 +3868,14 @@
   getOrCreateFunctionType(D, FnType, Unit), ScopeLine, Flags, SPFlags,
   TParamsArray.get(), getFunctionDeclaration(D));
 
-  if (IsDeclForCallSite)
-Fn->setSubprogram(SP);
+  // ObjC expects declarations within retained types.
+  if (!IsDeclForCallSite) {
+DBuilder.retainType(SP);
+return;
+  }
 
-  DBuilder.retainType(SP);
+  Fn->setSubprogram(SP);
+  DBuilder.finalizeSubprogram(SP);
 }
 
 void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80369: WIP: [DebugInfo] Remove decl subprograms from 'retainedTypes:'

2020-05-21 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 265481.
djtodoro retitled this revision from "[DebugInfo] Remove decl subprograms from 
'retainedTypes:'" to "WIP: [DebugInfo] Remove decl subprograms from 
'retainedTypes:'".
djtodoro added a comment.

Still have test failing:

  Clang :: Modules/DebugInfoTransitiveImport.m
  Clang :: Modules/ModuleDebugInfo.cpp
  Clang :: Modules/ModuleDebugInfo.m

I haven't looked into the failures, but I guess something Objective-C++ related 
should be handled with some additional work here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80369/new/

https://reviews.llvm.org/D80369

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-extern-call.c


Index: clang/test/CodeGen/debug-info-extern-call.c
===
--- clang/test/CodeGen/debug-info-extern-call.c
+++ clang/test/CodeGen/debug-info-extern-call.c
@@ -1,6 +1,10 @@
 // When entry values are emitted, expect a subprogram for extern decls so that
 // the dwarf generator can describe call site parameters at extern call sites.
 //
+// Initial implementation relied on the 'retainedTypes:' from the corresponding
+// DICompileUnit, so we also ensure that we do not store the extern declaration
+// subprogram into the 'retainedTypes:'.
+//
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
 // RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
 
@@ -17,6 +21,8 @@
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o 
- \
 // RUN:   | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN
 
+// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: 
![[RETTYPES:[0-9]+]]
+// DECLS-FOR-EXTERN-NOT: ![[RETTYPES]] = !{
 // DECLS-FOR-EXTERN: !DISubprogram(name: "fn1"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3871,7 +3871,7 @@
   if (IsDeclForCallSite)
 Fn->setSubprogram(SP);
 
-  DBuilder.retainType(SP);
+  DBuilder.finalizeSubprogram(SP);
 }
 
 void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,


Index: clang/test/CodeGen/debug-info-extern-call.c
===
--- clang/test/CodeGen/debug-info-extern-call.c
+++ clang/test/CodeGen/debug-info-extern-call.c
@@ -1,6 +1,10 @@
 // When entry values are emitted, expect a subprogram for extern decls so that
 // the dwarf generator can describe call site parameters at extern call sites.
 //
+// Initial implementation relied on the 'retainedTypes:' from the corresponding
+// DICompileUnit, so we also ensure that we do not store the extern declaration
+// subprogram into the 'retainedTypes:'.
+//
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
 // RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
 
@@ -17,6 +21,8 @@
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o - \
 // RUN:   | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN
 
+// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: ![[RETTYPES:[0-9]+]]
+// DECLS-FOR-EXTERN-NOT: ![[RETTYPES]] = !{
 // DECLS-FOR-EXTERN: !DISubprogram(name: "fn1"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3871,7 +3871,7 @@
   if (IsDeclForCallSite)
 Fn->setSubprogram(SP);
 
-  DBuilder.retainType(SP);
+  DBuilder.finalizeSubprogram(SP);
 }
 
 void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80369: [DebugInfo] Remove decl subprograms from 'retainedTypes:'

2020-05-21 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro created this revision.
djtodoro added reviewers: dblaikie, aprantl, vsk.
djtodoro added projects: LLVM, debug-info.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

After the D70350 , the `retainedTypes:` isn't 
being used for the purpose of call site debug info for extern calls, so it is 
safe to delete it from IR representation.
We are also adding a test to ensure the subprogram isn't stored within the 
`retainedTypes:` from corresponding `DICompileUnit`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80369

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-extern-call.c


Index: clang/test/CodeGen/debug-info-extern-call.c
===
--- clang/test/CodeGen/debug-info-extern-call.c
+++ clang/test/CodeGen/debug-info-extern-call.c
@@ -1,6 +1,10 @@
 // When entry values are emitted, expect a subprogram for extern decls so that
 // the dwarf generator can describe call site parameters at extern call sites.
 //
+// Initial implementation relied on the 'retainedTypes:' from the corresponding
+// DICompileUnit, so we also ensure that we do not store the extern declaration
+// subprogram into the 'retainedTypes:'.
+//
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
 // RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
 
@@ -17,6 +21,8 @@
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o 
- \
 // RUN:   | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN
 
+// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: 
![[RETTYPES:[0-9]+]]
+// DECLS-FOR-EXTERN-NOT: ![[RETTYPES]] = !{
 // DECLS-FOR-EXTERN: !DISubprogram(name: "fn1"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3870,8 +3870,6 @@
 
   if (IsDeclForCallSite)
 Fn->setSubprogram(SP);
-
-  DBuilder.retainType(SP);
 }
 
 void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,


Index: clang/test/CodeGen/debug-info-extern-call.c
===
--- clang/test/CodeGen/debug-info-extern-call.c
+++ clang/test/CodeGen/debug-info-extern-call.c
@@ -1,6 +1,10 @@
 // When entry values are emitted, expect a subprogram for extern decls so that
 // the dwarf generator can describe call site parameters at extern call sites.
 //
+// Initial implementation relied on the 'retainedTypes:' from the corresponding
+// DICompileUnit, so we also ensure that we do not store the extern declaration
+// subprogram into the 'retainedTypes:'.
+//
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
 // RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
 
@@ -17,6 +21,8 @@
 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o - \
 // RUN:   | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN
 
+// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: ![[RETTYPES:[0-9]+]]
+// DECLS-FOR-EXTERN-NOT: ![[RETTYPES]] = !{
 // DECLS-FOR-EXTERN: !DISubprogram(name: "fn1"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3870,8 +3870,6 @@
 
   if (IsDeclForCallSite)
 Fn->setSubprogram(SP);
-
-  DBuilder.retainType(SP);
 }
 
 void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79967: Fix debug info for NoDebug attr

2020-05-19 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

This seems reasonable, so this change looks good to me!

@dblaikie Thanks for pointing out to the potential problems of the usage of the 
func decl !dbg in the purpose of call sites debug info. It is currently being 
stored into CU's retainedTypes field.

> That's why DISubprogram moved to be attached to an llvm::Function (previously 
> all DISubprograms were listed on the CU and DISubprograms pointed to 
> llvm::Functions) to aid in LTO

Is it only one patch or a set of patches? I'll try to find these changes in the 
log history.

I am open for the discussion about redesigning it (please wait for a comment 
from @vsk as well). :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79967/new/

https://reviews.llvm.org/D79967



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78105: [CSInfo][ISEL] Call site info generation support for Mips

2020-05-15 Thread Djordje Todorovic via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG170ac4be3392: [CSInfo][ISEL] Call site info generation 
support for Mips (authored by djtodoro).
Herald added subscribers: cfe-commits, jrtc27.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78105/new/

https://reviews.llvm.org/D78105

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  llvm/lib/Target/Mips/MipsISelLowering.cpp
  llvm/lib/Target/Mips/MipsTargetMachine.cpp
  llvm/test/CodeGen/Mips/call-site-info-output.ll
  llvm/test/CodeGen/Mips/dbg-call-site-info-reg-d-split.ll
  llvm/test/DebugInfo/Mips/dw_op_entry_value_32bit.ll
  llvm/test/DebugInfo/Mips/dw_op_entry_value_64bit.ll

Index: llvm/test/DebugInfo/Mips/dw_op_entry_value_64bit.ll
===
--- /dev/null
+++ llvm/test/DebugInfo/Mips/dw_op_entry_value_64bit.ll
@@ -0,0 +1,77 @@
+;; Test mips64:
+; RUN: llc -emit-call-site-info -stop-after=livedebugvalues -mtriple=mips64-linux-gnu -o - %s | FileCheck %s --check-prefix=CHECK64
+;; Test mips64el:
+; RUN: llc -emit-call-site-info -stop-after=livedebugvalues -mtriple=mips64el-linux-gnu -o - %s | FileCheck %s --check-prefix=CHECK64el
+
+;; Built from source:
+;; extern long fn1(long,long,long);
+;; long fn2(long a, long b, long c) {
+;;   long local = fn1(a+b, c, b+10);
+;;   if (local > 10)
+;; return local + 10;
+;;   return b;
+;; }
+;; Using command:
+;; clang -g -O2 -target mips64-linux-gnu m.c -c -S -emit-llvm
+;; Confirm that info from callSites attribute is used as entry_value in DIExpression.
+
+;; Test mips64:
+; CHECK64: $a0_64 = nsw DADDu $a1_64, killed renamable $a0_64,
+; CHECK64-NEXT: DBG_VALUE $a0_64, $noreg, !15, !DIExpression(DW_OP_LLVM_entry_value, 1)
+
+;; Test mips64el:
+; CHECK64el: $a0_64 = nsw DADDu $a1_64, killed renamable $a0_64,
+; CHECK64el-NEXT: DBG_VALUE $a0_64, $noreg, !15, !DIExpression(DW_OP_LLVM_entry_value, 1)
+
+; ModuleID = 'm.c'
+source_filename = "m.c"
+target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128"
+target triple = "mips64-unknown-linux-gnu"
+
+; Function Attrs: nounwind
+define i64 @fn2(i64 signext %a, i64 signext %b, i64 signext %c) local_unnamed_addr !dbg !13 {
+entry:
+  call void @llvm.dbg.value(metadata i64 %a, metadata !15, metadata !DIExpression()), !dbg !19
+  call void @llvm.dbg.value(metadata i64 %b, metadata !16, metadata !DIExpression()), !dbg !19
+  call void @llvm.dbg.value(metadata i64 %c, metadata !17, metadata !DIExpression()), !dbg !19
+  %add = add nsw i64 %b, %a, !dbg !19
+  %add1 = add nsw i64 %b, 10, !dbg !19
+  %call = tail call i64 @fn1(i64 signext %add, i64 signext %c, i64 signext %add1), !dbg !19
+  call void @llvm.dbg.value(metadata i64 %call, metadata !18, metadata !DIExpression()), !dbg !19
+  %cmp = icmp sgt i64 %call, 10, !dbg !23
+  %add2 = add nsw i64 %call, 10, !dbg !19
+  %retval.0 = select i1 %cmp, i64 %add2, i64 %b, !dbg !19
+  ret i64 %retval.0, !dbg !19
+}
+
+declare !dbg !4 i64 @fn1(i64 signext, i64 signext, i64 signext) local_unnamed_addr
+
+; Function Attrs: nounwind readnone speculatable willreturn
+declare void @llvm.dbg.value(metadata, metadata, metadata)
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!8, !9, !10, !11}
+!llvm.ident = !{!12}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "m.c", directory: "/dir")
+!2 = !{}
+!3 = !{!4}
+!4 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
+!5 = !DISubroutineType(types: !6)
+!6 = !{!7, !7, !7, !7}
+!7 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
+!8 = !{i32 7, !"Dwarf Version", i32 4}
+!9 = !{i32 2, !"Debug Info Version", i32 3}
+!10 = !{i32 1, !"wchar_size", i32 4}
+!11 = !{i32 7, !"PIC Level", i32 1}
+!12 = !{!"clang version 11.0.0"}
+!13 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 2, type: !5, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
+!14 = !{!15, !16, !17, !18}
+!15 = !DILocalVariable(name: "a", arg: 1, scope: !13, file: !1, line: 2, type: !7)
+!16 = !DILocalVariable(name: "b", arg: 2, scope: !13, file: !1, line: 2, type: !7)
+!17 = !DILocalVariable(name: "c", arg: 3, scope: !13, file: !1, line: 2, type: !7)
+!18 = !DILocalVariable(name: "local", scope: !13, file: !1, line: 3, type: !7)
+!19 = !DILocation(line: 0, scope: !13)
+!23 = !DILocation(line: 4, column: 13, scope: !24)
+!24 = distinct !DILexicalBlock(scope: !13, file: !1, line: 4, column: 7)
Index: llvm/test/DebugInfo/Mips/dw_op_entry_value_32bit.ll

[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-20 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D73534#1933985 , @djtodoro wrote:

> Oh sorry, I thought it all has been fixed, since all the tests pass.
>
> We should revert the D75036  until we fix 
> all the issues.


@dstenb do you agree?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-20 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Oh sorry, I thought it all has been fixed, since all the tests pass.

We should revert the D75036  until we fix all 
the issues.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-20 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D73534#1934105 , @vsk wrote:

> In D73534#1933988 , @djtodoro wrote:
>
> > In D73534#1933985 , @djtodoro 
> > wrote:
> >
> > > Oh sorry, I thought it all has been fixed, since all the tests pass.
> > >
> > > We should revert the D75036  until we 
> > > fix all the issues.
> >
> >
> > @dstenb do you agree?
>
>
> This was an oversight on my part, the fix from D76164 
>  was not complete. I need a few more minutes 
> to write a test, but I should be able to fix this very soon. If we can 
> fix-forward, that would be easier.


@vsk That would be great. Thanks a lot!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-19 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Re-enabled with the d9b962100942 
.

If we face a failure again, since this enables the whole feature, I recommend 
reverting smaller pieces of the feature that was causing the problem, rather 
than reverting this patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-18 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Since we landed the fix for the issue related to the D75036 
, I'll reland this again.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-14 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Why reverting this one? Is it a different assertion?

The D75036  was the problem with the previous 
issue reported.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-12 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D73534#1916309 , @djtodoro wrote:

> In D73534#1916291 , @djtodoro wrote:
>
> > In D73534#1915048 , @mstorsjo 
> > wrote:
> >
> > > This broke compiling for mingw, repro.c:
> > >
> > >   a(short);
> > >   b() { a(1); }
> > >
> > >
> > > `clang -target x86_64-w64-mingw32 -c repro.c -g -O2`, which gives 
> > > `Assertion '!MI.isMoveImmediate() && "Unexpected MoveImm instruction"' 
> > > failed.`
> >
> >
> > Thanks for reporting this! Since this is the case of the `X86::MOV16ri` the 
> > D75326  will solve this issue.
>
>
> The alternative is D75974 .


The D75974  is commited.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-11 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D73534#1915048 , @mstorsjo wrote:

> This broke compiling for mingw, repro.c:
>
>   a(short);
>   b() { a(1); }
>
>
> `clang -target x86_64-w64-mingw32 -c repro.c -g -O2`, which gives `Assertion 
> '!MI.isMoveImmediate() && "Unexpected MoveImm instruction"' failed.`


Thanks for reporting this! Since this is the case of the `X86::MOV16ri` the 
D75326  will solve this issue.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-11 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D73534#1916291 , @djtodoro wrote:

> In D73534#1915048 , @mstorsjo wrote:
>
> > This broke compiling for mingw, repro.c:
> >
> >   a(short);
> >   b() { a(1); }
> >
> >
> > `clang -target x86_64-w64-mingw32 -c repro.c -g -O2`, which gives 
> > `Assertion '!MI.isMoveImmediate() && "Unexpected MoveImm instruction"' 
> > failed.`
>
>
> Thanks for reporting this! Since this is the case of the `X86::MOV16ri` the 
> D75326  will solve this issue.


The alternative is D75974 .


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D75175: [CallSiteInfo] Enable the call site info only for -g + optimizations

2020-03-09 Thread Djordje Todorovic via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc15c68abdc6f: [CallSiteInfo] Enable the call site info only 
for -g + optimizations (authored by djtodoro).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D75175?vs=248667=249060#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75175/new/

https://reviews.llvm.org/D75175

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  llvm/include/llvm/CodeGen/CommandFlags.inc
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/lib/CodeGen/MachineFunction.cpp
  llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/MIR/Hexagon/bundled-call-site-info.mir
  llvm/test/CodeGen/X86/call-site-info-output.ll
  llvm/test/DebugInfo/AArch64/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/call-site-info-output.ll
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-chain.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-entry-value.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpret-movzxi.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
  llvm/test/DebugInfo/MIR/AArch64/implicit-def-dead-scope.mir
  llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovd.mir
  llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovs.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcallsite-noreg-is-imm-check.mir
  llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir
  llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir
  llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir
  llvm/test/DebugInfo/MIR/SystemZ/call-site-lzer.mir
  llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
  llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
  llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg-multiple-defs.mir
  llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-copy-super-sub.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-partial-describe.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reg-shuffle.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
  llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir
  llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
  llvm/test/DebugInfo/MIR/X86/unreachable-block-call-site.mir
  llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
  llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
  llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll

Index: llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
===
--- llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
+++ llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
@@ -1,4 +1,4 @@
-; RUN: llc -debug-entry-values %s -o - -filetype=obj \
+; RUN: llc -emit-call-site-info -debug-entry-values %s -o - -filetype=obj \
 ; RUN:   | llvm-dwarfdump -statistics - | FileCheck %s
 ;
 ; The LLVM IR file was generated on this source code by using
Index: llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
===
--- llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
+++ llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
@@ -1,4 +1,4 @@
-; RUN: llc -O3 -debug-entry-values -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -O3 -emit-call-site-info -debug-entry-values -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
Index: llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
===
--- llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
+++ llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
@@ -1,4 +1,4 @@
-; RUN: llc -O1 -debug-entry-values -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -O1 -emit-call-site-info -debug-entry-values -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
 
 ; Verify that the 64-bit call site 

[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

@ostannard Thanks for reporting that! Please share the case.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Nice! Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-20 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Reverted again with rG2f215cf36adc 
. The 
investigation is needed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-19 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D73534#1883022 , @nickdesaulniers 
wrote:

> In D73534#1882136 , @djtodoro wrote:
>
> > - Address the issue with ARM `describeLoadedValue()` (thanks to @vsk, I've 
> > reduced the test 
> > `llvm/test/DebugInfo/MIR/ARM/dbgcallsite-noreg-is-imm-check.mir`)
>
>
> I'd like to help test this, but `arc patch D73534` is now failing with merge 
> conflicts. Can you please rebase this on master?


I’ve already pushed this. Please rebase on the latest commits.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-19 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

In D73534#1882118 , @dstenb wrote:

> In D73534#1881353 , @nickdesaulniers 
> wrote:
>
> > As a heads up, Linaro's ToolChain Working Group's Linux kernel CI lit up on 
> > this change. I see it's been reverted (thank you). Please cc me on the 
> > updated patch and I can help test it against the Linux kernel.
> >
> > Edit: Link: 
> > https://ci.linaro.org/job/tcwg_kernel-bisect-llvm-master-arm-mainline-allyesconfig/25/artifact/artifacts/build-a82d3e8a6e67473c94a5ce6345372748e9b61718/03-build_linux/console.log
>
>
> Its hard to tell from the backtrace, but looking at the code, I think this 
> might be a bug that sneaked in when I did D70431 
> . Sorry if that is the case!
>
> `ARMBaseInstrInfo::isAddImmediate()` does a `getReg()` without any `isReg()` 
> guard:
>
>   Optional ARMBaseInstrInfo::isAddImmediate(const MachineInstr 
> ,  
>   
>   
> 
> Register Reg) const { 
>   
>   
>   
>  
>   [...]
> // TODO: Handle cases where Reg is a super- or sub-register of the
>   
>   
>   
>  
> // destination register.
> if (Reg != MI.getOperand(0).getReg())
>   return None;
>


@dstenb No problem, we have already addressed the issue. Thanks to @vsk and 
@nickdesaulniers! I'll update the patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-19 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 245345.
djtodoro added a comment.

- Address the issue with ARM `describeLoadedValue()` (thanks to @vsk, I've 
reduced the test 
`llvm/test/DebugInfo/MIR/ARM/dbgcallsite-noreg-is-imm-check.mir`)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/debug-info-extern-call.c
  clang/test/CodeGenCXX/dbg-info-all-calls-described.cpp
  lldb/packages/Python/lldbsuite/test/decorators.py
  
lldb/test/API/functionalities/param_entry_vals/basic_entry_values_x86_64/Makefile
  llvm/include/llvm/CodeGen/CommandFlags.inc
  llvm/include/llvm/Target/TargetMachine.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
  llvm/lib/CodeGen/LiveDebugValues.cpp
  llvm/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/lib/CodeGen/MachineFunction.cpp
  llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
  llvm/lib/CodeGen/TargetOptionsImpl.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/test/CodeGen/AArch64/arm64-anyregcc.ll
  llvm/test/CodeGen/AArch64/arm64-patchpoint.ll
  llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll
  llvm/test/CodeGen/ARM/smml.ll
  llvm/test/CodeGen/MIR/Hexagon/bundled-call-site-info.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error1.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error2.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error3.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error4.mir
  llvm/test/CodeGen/X86/call-site-info-output.ll
  llvm/test/CodeGen/X86/hoist-invariant-load.ll
  llvm/test/CodeGen/X86/speculative-load-hardening-indirect.ll
  llvm/test/CodeGen/X86/statepoint-allocas.ll
  llvm/test/CodeGen/X86/tail-dup-repeat.ll
  llvm/test/CodeGen/X86/xray-custom-log.ll
  llvm/test/CodeGen/X86/xray-typed-event-log.ll
  llvm/test/DebugInfo/AArch64/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/entry-value-multi-byte-expr.ll
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpret-movzxi.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcallsite-noreg-is-imm-check.mir
  llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir
  llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir
  llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir
  llvm/test/DebugInfo/MIR/SystemZ/call-site-lzer.mir
  llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
  llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
  llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg-multiple-defs.mir
  llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-copy-super-sub.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-partial-describe.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reg-shuffle.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
  llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir
  llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir
  llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
  llvm/test/DebugInfo/MIR/X86/unreachable-block-call-site.mir
  llvm/test/DebugInfo/Sparc/entry-value-complex-reg-expr.ll
  llvm/test/DebugInfo/X86/dbg-value-range.ll
  llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
  llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
  llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
  llvm/test/DebugInfo/X86/loclists-dwp.ll
  llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll
  llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
  llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
  llvm/test/tools/llvm-dwarfdump/X86/valid-call-site-GNU-extensions.ll
  llvm/test/tools/llvm-locstats/locstats.ll

Index: 

[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-18 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

I’ve already reverted the patch, but I’ll reland it again tomorrow. Thanks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-18 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Thanks for reporting that, are you sure this was the cause of the failure? I'll 
revert this while investigate, but it does not seem to me this is related to 
this patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-18 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 245123.
djtodoro added a comment.

-Addressing the latest comments


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/debug-info-extern-call.c
  clang/test/CodeGenCXX/dbg-info-all-calls-described.cpp
  lldb/packages/Python/lldbsuite/test/decorators.py
  
lldb/test/API/functionalities/param_entry_vals/basic_entry_values_x86_64/Makefile
  llvm/include/llvm/CodeGen/CommandFlags.inc
  llvm/include/llvm/Target/TargetMachine.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
  llvm/lib/CodeGen/LiveDebugValues.cpp
  llvm/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/lib/CodeGen/MachineFunction.cpp
  llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
  llvm/lib/CodeGen/TargetOptionsImpl.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/test/CodeGen/ARM/smml.ll
  llvm/test/CodeGen/MIR/Hexagon/bundled-call-site-info.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error1.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error2.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error3.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error4.mir
  llvm/test/CodeGen/X86/call-site-info-output.ll
  llvm/test/CodeGen/X86/tail-dup-repeat.ll
  llvm/test/DebugInfo/AArch64/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/entry-value-multi-byte-expr.ll
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpret-movzxi.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
  llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir
  llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir
  llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir
  llvm/test/DebugInfo/MIR/SystemZ/call-site-lzer.mir
  llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
  llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
  llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-copy-super-sub.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-partial-describe.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reg-shuffle.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
  llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir
  llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir
  llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
  llvm/test/DebugInfo/MIR/X86/unreachable-block-call-site.mir
  llvm/test/DebugInfo/Sparc/entry-value-complex-reg-expr.ll
  llvm/test/DebugInfo/X86/dbg-value-range.ll
  llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
  llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
  llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
  llvm/test/DebugInfo/X86/loclists-dwp.ll
  llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll
  llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
  llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
  llvm/test/tools/llvm-dwarfdump/X86/valid-call-site-GNU-extensions.ll
  llvm/test/tools/llvm-locstats/locstats.ll

Index: llvm/test/tools/llvm-locstats/locstats.ll
===
--- llvm/test/tools/llvm-locstats/locstats.ll
+++ llvm/test/tools/llvm-locstats/locstats.ll
@@ -9,9 +9,9 @@
 ; LOCSTATS: [10%,20%) 0 0%
 ; LOCSTATS: [20%,30%) 1 11%
 ; LOCSTATS: [30%,40%) 0 0%
-; LOCSTATS: [40%,50%) 1 11%
-; LOCSTATS: [50%,60%) 1 11%
-; LOCSTATS: [60%,70%) 1 11%
+; LOCSTATS: [40%,50%) 0 0%
+; LOCSTATS: [50%,60%) 0 0%
+; LOCSTATS: [60%,70%) 3 33%
 ; LOCSTATS: [70%,80%) 0 0%
 ; LOCSTATS: [80%,90%) 2 22%
 ; LOCSTATS: [90%,100%) 1 11%
Index: llvm/test/tools/llvm-dwarfdump/X86/valid-call-site-GNU-extensions.ll
===
--- 

[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-12 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro marked an inline comment as done.
djtodoro added inline comments.



Comment at: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:870
 if (MI->isCandidateForCallSiteEntry() &&
-DAG->getTarget().Options.EnableDebugEntryValues)
+DAG->getTarget().Options.SupportsDebugEntryValues)
   MF.addCallArgsForwardingRegs(MI, DAG->getSDCallSiteInfo(Node));

dstenb wrote:
> I'm sorry for commenting on this so late, but when now adapting this patch 
> for our downstream target, for which we will not enable call site info by 
> default yet, I noticed that the call site information wasn't added. I think 
> that this should be `ShouldEmitDebugEntryValues()`.
I thought to restrict the production of the call site info here and only to 
allow a hand-made testing, but I think you are right, we should use the 
`ShouldEmitDebugEntryValues()`. I'll update the patch, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-12 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Reverted due to 
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/21373/steps/build-stage3-compiler/logs/stdio.

I will reland this as soon as I fix the issue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-12 Thread Djordje Todorovic via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9f6ff07f8a39: [DebugInfo] Enable the debug entry values 
feature by default (authored by djtodoro).
Herald added subscribers: lldb-commits, cfe-commits, jrtc27.
Herald added projects: clang, LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D73534?vs=243759=244101#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/debug-info-extern-call.c
  clang/test/CodeGenCXX/dbg-info-all-calls-described.cpp
  lldb/packages/Python/lldbsuite/test/decorators.py
  
lldb/test/API/functionalities/param_entry_vals/basic_entry_values_x86_64/Makefile
  llvm/include/llvm/CodeGen/CommandFlags.inc
  llvm/include/llvm/Target/TargetMachine.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
  llvm/lib/CodeGen/LiveDebugValues.cpp
  llvm/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/lib/CodeGen/MachineFunction.cpp
  llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
  llvm/lib/CodeGen/TargetOptionsImpl.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/test/CodeGen/ARM/smml.ll
  llvm/test/CodeGen/MIR/Hexagon/bundled-call-site-info.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error1.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error2.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error3.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error4.mir
  llvm/test/CodeGen/X86/call-site-info-output.ll
  llvm/test/DebugInfo/AArch64/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/entry-value-multi-byte-expr.ll
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpret-movzxi.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
  llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir
  llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir
  llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir
  llvm/test/DebugInfo/MIR/SystemZ/call-site-lzer.mir
  llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
  llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
  llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-copy-super-sub.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-partial-describe.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reg-shuffle.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
  llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir
  llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir
  llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
  llvm/test/DebugInfo/MIR/X86/unreachable-block-call-site.mir
  llvm/test/DebugInfo/Sparc/entry-value-complex-reg-expr.ll
  llvm/test/DebugInfo/X86/dbg-value-range.ll
  llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
  llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
  llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
  llvm/test/DebugInfo/X86/loclists-dwp.ll
  llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll
  llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
  llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
  llvm/test/tools/llvm-dwarfdump/X86/valid-call-site-GNU-extensions.ll
  llvm/test/tools/llvm-locstats/locstats.ll

Index: llvm/test/tools/llvm-locstats/locstats.ll
===
--- llvm/test/tools/llvm-locstats/locstats.ll
+++ llvm/test/tools/llvm-locstats/locstats.ll
@@ -9,9 +9,9 @@
 ; LOCSTATS: [10%,20%) 0 0%
 ; LOCSTATS: [20%,30%) 1 11%
 ; LOCSTATS: [30%,40%) 0 0%
-; LOCSTATS: [40%,50%) 1 11%
-; LOCSTATS: [50%,60%) 1 11%
-; LOCSTATS: [60%,70%) 1 11%
+; LOCSTATS: [40%,50%) 0 0%
+; LOCSTATS: [50%,60%) 0 0%
+; LOCSTATS: [60%,70%) 3 33%
 ; LOCSTATS: [70%,80%) 0 0%
 ; 

[PATCH] D73261: [dwarf5] Support DebugInfo for constexpr for C++ variables and functions

2020-02-11 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

@awpandey Thanks for doing this, but could you please explain the motivation of 
implementing this? Can we use is (somehow) to generate more variables with the 
`DW_AT_const_value`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73261/new/

https://reviews.llvm.org/D73261



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73261: [dwarf5] Support DebugInfo for constexpr for C++ variables and functions

2020-02-11 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added inline comments.



Comment at: llvm/include/llvm/IR/DebugInfoFlags.def:61
 HANDLE_DI_FLAG((1 << 29), AllCallsDescribed)
+HANDLE_DI_FLAG((1 << 30), ConstExpr)
 

We are almost out of space here... I wouldn't add any additional flag here 
before we do necessary refactoring. 

As we discussed, it makes sense moving the function-related flags into the 
existing `DISPFlags`. In addition, we may want to introduce something like 
`DIVarFlags`, and move the variable-related flags into that.

Also, we need to pay attention on the bitcode compatibility as well. Back then, 
I have implemented something similar here: https://reviews.llvm.org/D59288, so 
it can be used as a reference.

I think we have to do it first, as a preparation patch for this one.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73261/new/

https://reviews.llvm.org/D73261



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73261: [dwarf5] Support DebugInfo for constexpr for C++ variables and functions

2020-01-24 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

I agree, we must pay attention and address the bitcode compatibility.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73261/new/

https://reviews.llvm.org/D73261



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D73261: [dwarf5] Support DebugInfo for constexpr for C++ variables and functions

2020-01-24 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

> Is it necessary to use DIFlags? I am willing to do that but generally, it is 
> not welcomed because we have a limited number of DIFlags and most of them are 
> currently in use.

Are there any flags within `DIFlags` that could be applied only to functions? 
If so, we should move them in to the `DISPFlags` in order to make some space 
within the `DIFlags`.
In addition, does it make sense to making something like `DIVarFlags`? And move 
the flags applying only to variables.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73261/new/

https://reviews.llvm.org/D73261



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69970: [CGDebugInfo] Emit subprograms for decls when AT_tail_call is understood (reland with fixes)

2020-01-13 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

I guess this should be closed? :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69970/new/

https://reviews.llvm.org/D69970



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70111: [DWARF5]Addition of alignment field in the typedef for dwarf5

2019-12-25 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added inline comments.



Comment at: llvm/docs/ReleaseNotes.rst:169
 
+* C DebugInfo API ``LLVMDIBuilderCreateTypedef`` is updated to include an extra
+argument ``AlignInBits``, to facilitate / propagate specified Alignment 
information

SouraVX wrote:
> djtodoro wrote:
> > djtodoro wrote:
> > > It looks like this breaks the llvm-sphinx-docs build.
> > Fixed with the 5762648.
> > 
> > Please take a look into the http://lab.llvm.org:8011/console when 
> > committing changes. There you can find info about build bots failures, if 
> > any.
> Thank You @djtodoro , had a brief look at 5762648. Seems good. 
> BTW are sphinx bots still failing due to this ?
The builder is back to passing again.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70111/new/

https://reviews.llvm.org/D70111



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70111: [DWARF5]Addition of alignment field in the typedef for dwarf5

2019-12-24 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added inline comments.



Comment at: llvm/docs/ReleaseNotes.rst:169
 
+* C DebugInfo API ``LLVMDIBuilderCreateTypedef`` is updated to include an extra
+argument ``AlignInBits``, to facilitate / propagate specified Alignment 
information

djtodoro wrote:
> It looks like this breaks the llvm-sphinx-docs build.
Fixed with the 5762648.

Please take a look into the http://lab.llvm.org:8011/console when committing 
changes. There you can find info about build bots failures, if any.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70111/new/

https://reviews.llvm.org/D70111



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70111: [DWARF5]Addition of alignment field in the typedef for dwarf5

2019-12-23 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added inline comments.



Comment at: llvm/docs/ReleaseNotes.rst:169
 
+* C DebugInfo API ``LLVMDIBuilderCreateTypedef`` is updated to include an extra
+argument ``AlignInBits``, to facilitate / propagate specified Alignment 
information

It looks like this breaks the llvm-sphinx-docs build.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70111/new/

https://reviews.llvm.org/D70111



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68206: [clang] Remove the DIFlagArgumentNotModified debug info flag

2019-11-20 Thread Djordje Todorovic via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGce1f95a6e077: Reland [clang] Remove the 
DIFlagArgumentNotModified debug info flag (authored by djtodoro).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68206/new/

https://reviews.llvm.org/D68206

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGen/debug-info-param-modification.c
  
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py

Index: lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
@@ -6,7 +6,8 @@
 supported_platforms.extend(lldbplatformutil.getDarwinOSTriples())
 
 lldbinline.MakeInlineTest(__file__, globals(),
-[decorators.skipUnlessPlatform(supported_platforms),
+[decorators.skipIf(bugnumber="llvm.org/pr44059"),
+ decorators.skipUnlessPlatform(supported_platforms),
  decorators.skipIf(compiler="clang", compiler_version=['<', '10.0']),
  decorators.skipUnlessArch('x86_64'),
  decorators.skipUnlessHasCallSiteInfo,
Index: clang/test/CodeGen/debug-info-param-modification.c
===
--- clang/test/CodeGen/debug-info-param-modification.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target x86_64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target arm-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target aarch64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target armeb-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "a", arg: 1, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}})
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
-//
-// For the os_log_helper:
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: DIFlagArtificial)
-//
-// RUN: %clang -g -O2 -Xclang -disable-llvm-passes -target x86_64-none-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// CHECK-NOT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
-//
-// For the os_log_helper:
-// CHECK: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: DIFlagArtificial)
-
-int fn2 (int a, int b) {
-  ++a;
-  return b;
-}
-
-void test_builtin_os_log(void *buf, int i, const char *data) {
-  __builtin_os_log_format(buf, "%d %{public}s %{private}.16P", i, data, data);
-}
Index: clang/lib/CodeGen/CGDebugInfo.h
===
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -146,10 +146,6 @@
 
   llvm::DenseMap DIFileCache;
   llvm::DenseMap SPCache;
-  /// Cache function definitions relevant to use for parameters mutation
-  /// analysis.
-  llvm::DenseMap SPDefCache;
-  llvm::DenseMap ParamCache;
   /// Cache declarations relevant to DW_TAG_imported_declarations (C++
   /// using declarations) that aren't covered by other more specific caches.
   llvm::DenseMap DeclCache;
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -18,7 +18,6 @@
 #include "CodeGenFunction.h"
 #include "CodeGenModule.h"
 #include "ConstantEmitter.h"
-#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclObjC.h"
@@ -3686,15 +3685,6 @@
   if (HasDecl && isa(D))
 DeclCache[D->getCanonicalDecl()].reset(SP);
 
-  // We use the SPDefCache only in the case when the debug entry values option
-  // is set, in order to speed up parameters modification analysis.
-  //
-  // FIXME: Use AbstractCallee here to support ObjCMethodDecl.
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl)
-if (auto 

[PATCH] D68206: [clang] Remove the DIFlagArgumentNotModified debug info flag

2019-11-19 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

@vsk I have created the bug (llvm.org/pr44059), do you think this is OK?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68206/new/

https://reviews.llvm.org/D68206



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68206: [clang] Remove the DIFlagArgumentNotModified debug info flag

2019-11-19 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 230054.
djtodoro added a comment.

-Update the lldb test for the entry values feature


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68206/new/

https://reviews.llvm.org/D68206

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGen/debug-info-param-modification.c
  
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py

Index: lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
@@ -6,7 +6,8 @@
 supported_platforms.extend(lldbplatformutil.getDarwinOSTriples())
 
 lldbinline.MakeInlineTest(__file__, globals(),
-[decorators.skipUnlessPlatform(supported_platforms),
+[decorators.skipIf(bugnumber="llvm.org/pr44059"),
+ decorators.skipUnlessPlatform(supported_platforms),
  decorators.skipIf(compiler="clang", compiler_version=['<', '10.0']),
  decorators.skipUnlessArch('x86_64'),
  decorators.skipUnlessHasCallSiteInfo,
Index: clang/test/CodeGen/debug-info-param-modification.c
===
--- clang/test/CodeGen/debug-info-param-modification.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target x86_64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target arm-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target aarch64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target armeb-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "a", arg: 1, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}})
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
-//
-// For the os_log_helper:
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: DIFlagArtificial)
-//
-// RUN: %clang -g -O2 -Xclang -disable-llvm-passes -target x86_64-none-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// CHECK-NOT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
-//
-// For the os_log_helper:
-// CHECK: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: DIFlagArtificial)
-
-int fn2 (int a, int b) {
-  ++a;
-  return b;
-}
-
-void test_builtin_os_log(void *buf, int i, const char *data) {
-  __builtin_os_log_format(buf, "%d %{public}s %{private}.16P", i, data, data);
-}
Index: clang/lib/CodeGen/CGDebugInfo.h
===
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -146,10 +146,6 @@
 
   llvm::DenseMap DIFileCache;
   llvm::DenseMap SPCache;
-  /// Cache function definitions relevant to use for parameters mutation
-  /// analysis.
-  llvm::DenseMap SPDefCache;
-  llvm::DenseMap ParamCache;
   /// Cache declarations relevant to DW_TAG_imported_declarations (C++
   /// using declarations) that aren't covered by other more specific caches.
   llvm::DenseMap DeclCache;
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -18,7 +18,6 @@
 #include "CodeGenFunction.h"
 #include "CodeGenModule.h"
 #include "ConstantEmitter.h"
-#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclObjC.h"
@@ -3686,15 +3685,6 @@
   if (HasDecl && isa(D))
 DeclCache[D->getCanonicalDecl()].reset(SP);
 
-  // We use the SPDefCache only in the case when the debug entry values option
-  // is set, in order to speed up parameters modification analysis.
-  //
-  // FIXME: Use AbstractCallee here to support ObjCMethodDecl.
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl)
-if (auto *FD = dyn_cast(D))
-  if (FD->hasBody() && !FD->param_empty())
-SPDefCache[FD].reset(SP);
-
   // Push the function onto the lexical block stack.
   

[PATCH] D68206: [clang] Remove the DIFlagArgumentNotModified debug info flag

2019-11-16 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

I will do that way.
Yes, only the entry values test fails, so we should skip only that one.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68206/new/

https://reviews.llvm.org/D68206



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68206: [clang] Remove the DIFlagArgumentNotModified debug info flag

2019-11-15 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro updated this revision to Diff 229495.
djtodoro added a comment.

-Add the workaround in the LLDB test


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68206/new/

https://reviews.llvm.org/D68206

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGen/debug-info-param-modification.c
  lldb/packages/Python/lldbsuite/test/decorators.py

Index: lldb/packages/Python/lldbsuite/test/decorators.py
===
--- lldb/packages/Python/lldbsuite/test/decorators.py
+++ lldb/packages/Python/lldbsuite/test/decorators.py
@@ -693,6 +693,9 @@
 if not compiler.startswith("clang"):
 return "Test requires clang as compiler"
 
+if 1:
+return "Clang does not support the entry values at the moment"
+
 f = tempfile.NamedTemporaryFile()
 cmd = "echo 'int main() {}' | " \
   "%s -g -glldb -O1 -Xclang -femit-debug-entry-values -S -emit-llvm -x c -o %s -" % (compiler_path, f.name)
Index: clang/test/CodeGen/debug-info-param-modification.c
===
--- clang/test/CodeGen/debug-info-param-modification.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target x86_64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target arm-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target aarch64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target armeb-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "a", arg: 1, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}})
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
-//
-// For the os_log_helper:
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: DIFlagArtificial)
-//
-// RUN: %clang -g -O2 -Xclang -disable-llvm-passes -target x86_64-none-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// CHECK-NOT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
-//
-// For the os_log_helper:
-// CHECK: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: DIFlagArtificial)
-
-int fn2 (int a, int b) {
-  ++a;
-  return b;
-}
-
-void test_builtin_os_log(void *buf, int i, const char *data) {
-  __builtin_os_log_format(buf, "%d %{public}s %{private}.16P", i, data, data);
-}
Index: clang/lib/CodeGen/CGDebugInfo.h
===
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -146,10 +146,6 @@
 
   llvm::DenseMap DIFileCache;
   llvm::DenseMap SPCache;
-  /// Cache function definitions relevant to use for parameters mutation
-  /// analysis.
-  llvm::DenseMap SPDefCache;
-  llvm::DenseMap ParamCache;
   /// Cache declarations relevant to DW_TAG_imported_declarations (C++
   /// using declarations) that aren't covered by other more specific caches.
   llvm::DenseMap DeclCache;
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -18,7 +18,6 @@
 #include "CodeGenFunction.h"
 #include "CodeGenModule.h"
 #include "ConstantEmitter.h"
-#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclObjC.h"
@@ -3686,15 +3685,6 @@
   if (HasDecl && isa(D))
 DeclCache[D->getCanonicalDecl()].reset(SP);
 
-  // We use the SPDefCache only in the case when the debug entry values option
-  // is set, in order to speed up parameters modification analysis.
-  //
-  // FIXME: Use AbstractCallee here to support ObjCMethodDecl.
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl)
-if (auto *FD = dyn_cast(D))
-  if (FD->hasBody() && !FD->param_empty())
-SPDefCache[FD].reset(SP);
-
   // Push the function onto the lexical block stack.
   LexicalBlockStack.emplace_back(SP);
 
@@ -4089,11 +4079,6 @@
  llvm::DebugLoc::get(Line, Column, Scope, CurInlinedAt),
  Builder.GetInsertBlock());
 
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && ArgNo) {
-if (auto *PD = dyn_cast(VD))
-  ParamCache[PD].reset(D);
-  }
-
   return D;
 }
 
@@ -4709,29 +4694,6 @@
   TheCU->setDWOId(Signature);
 

[PATCH] D68206: [clang] Remove the DIFlagArgumentNotModified debug info flag

2019-11-15 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro reopened this revision.
djtodoro added a comment.
This revision is now accepted and ready to land.

After landing this, I see one LLDB test depends on this. I made a workaround to 
avoid testing it at the moment. I will remove the workaround when landing the 
D68209 .
WDYT?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68206/new/

https://reviews.llvm.org/D68206



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68206: [clang] Remove the DIFlagArgumentNotModified debug info flag

2019-11-15 Thread Djordje Todorovic via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1643734741d2: [clang] Remove the DIFlagArgumentNotModified 
debug info flag (authored by djtodoro).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68206/new/

https://reviews.llvm.org/D68206

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGen/debug-info-param-modification.c

Index: clang/test/CodeGen/debug-info-param-modification.c
===
--- clang/test/CodeGen/debug-info-param-modification.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target x86_64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target arm-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target aarch64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target armeb-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "a", arg: 1, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}})
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
-//
-// For the os_log_helper:
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: DIFlagArtificial)
-//
-// RUN: %clang -g -O2 -Xclang -disable-llvm-passes -target x86_64-none-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// CHECK-NOT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
-//
-// For the os_log_helper:
-// CHECK: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: DIFlagArtificial)
-
-int fn2 (int a, int b) {
-  ++a;
-  return b;
-}
-
-void test_builtin_os_log(void *buf, int i, const char *data) {
-  __builtin_os_log_format(buf, "%d %{public}s %{private}.16P", i, data, data);
-}
Index: clang/lib/CodeGen/CGDebugInfo.h
===
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -146,10 +146,6 @@
 
   llvm::DenseMap DIFileCache;
   llvm::DenseMap SPCache;
-  /// Cache function definitions relevant to use for parameters mutation
-  /// analysis.
-  llvm::DenseMap SPDefCache;
-  llvm::DenseMap ParamCache;
   /// Cache declarations relevant to DW_TAG_imported_declarations (C++
   /// using declarations) that aren't covered by other more specific caches.
   llvm::DenseMap DeclCache;
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -18,7 +18,6 @@
 #include "CodeGenFunction.h"
 #include "CodeGenModule.h"
 #include "ConstantEmitter.h"
-#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclObjC.h"
@@ -3686,15 +3685,6 @@
   if (HasDecl && isa(D))
 DeclCache[D->getCanonicalDecl()].reset(SP);
 
-  // We use the SPDefCache only in the case when the debug entry values option
-  // is set, in order to speed up parameters modification analysis.
-  //
-  // FIXME: Use AbstractCallee here to support ObjCMethodDecl.
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl)
-if (auto *FD = dyn_cast(D))
-  if (FD->hasBody() && !FD->param_empty())
-SPDefCache[FD].reset(SP);
-
   // Push the function onto the lexical block stack.
   LexicalBlockStack.emplace_back(SP);
 
@@ -4089,11 +4079,6 @@
  llvm::DebugLoc::get(Line, Column, Scope, CurInlinedAt),
  Builder.GetInsertBlock());
 
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && ArgNo) {
-if (auto *PD = dyn_cast(VD))
-  ParamCache[PD].reset(D);
-  }
-
   return D;
 }
 
@@ -4709,29 +4694,6 @@
   TheCU->setDWOId(Signature);
 }
 
-/// Analyzes each function parameter to determine whether it is constant
-/// throughout the function body.
-static void analyzeParametersModification(
-ASTContext ,
-llvm::DenseMap ,
-llvm::DenseMap ) {
-  for (auto  : SPDefCache) {
-auto *FD = SP.first;
-assert(FD->hasBody() && "Functions must have body here");
-const Stmt *FuncBody = (*FD).getBody();
-for (auto Parm : FD->parameters()) {
-  ExprMutationAnalyzer FuncAnalyzer(*FuncBody, Ctx);
-  if 

[PATCH] D69970: [CGDebugInfo] Emit subprograms for decls when AT_tail_call is understood (reland with fixes)

2019-11-14 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

I think that it sounds reasonable to avoid declaration subprograms for 
functions with reserved names, so that part looks good to me.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69970/new/

https://reviews.llvm.org/D69970



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70111: [DWARF5]Addition of alignment field in the typedef for dwarf5

2019-11-11 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

@awpandey Thanks for the patch!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70111/new/

https://reviews.llvm.org/D70111



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70111: [DWARF5]Addition of alignment field in the typedef for dwarf5

2019-11-11 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added inline comments.



Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:803
 
+  if (Tag == dwarf::DW_TAG_typedef && DD->getDwarfVersion() >= 5) {
+uint32_t AlignInBytes = DTy->getAlignInBytes();

Please add a comment here.



Comment at: llvm/test/DebugInfo/X86/debug-info-template-align.ll:26
+; ModuleID = 
'/home/awpandey/tools/llvm/tools/clang/test/CodeGenCXX/debug-info-template-align.cpp'
+source_filename = 
"/home/awpandey/tools/llvm/tools/clang/test/CodeGenCXX/debug-info-template-align.cpp"
+target datalayout = 
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

I guess you don't want to share your local path. It is enough to write 
'test.cpp' only.



Comment at: llvm/test/DebugInfo/X86/debug-info-template-align.ll:39
+; Function Attrs: nounwind readnone speculatable willreturn
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
+

So, we can get rid of the `#N`.



Comment at: llvm/test/DebugInfo/X86/debug-info-template-align.ll:41
+
+attributes #0 = { noinline norecurse nounwind optnone uwtable 
"correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" 
"frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" 
"no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" 
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false" 
"stack-protector-buffer-size"="8" "target-cpu"="x86-64" 
"target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" 
"use-soft-float"="false" }
+attributes #1 = { nounwind readnone speculatable willreturn }

Usually, you don't need the attributes.



Comment at: llvm/test/DebugInfo/X86/debug-info-template-align.ll:48
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, 
producer: "clang version 10.0.0 
(ssh://awpan...@idcvgits02.amd.com:29418/perfcompiler/er/llvm/cpu/clang 
8b3533f5560dd219a0e6d346be2190623822bada) (llvm/cpu/llvm 
61a342a7f3320d5517ba0bd012edc7cc908b36b7)", isOptimized: false, runtimeVersion: 
0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
+!1 = !DIFile(filename: 
"/home/awpandey/tools/llvm/tools/clang/test/CodeGenCXX/debug-info-template-align.cpp",
 directory: "/home/awpandey/tools/llvm/test/DebugInfo", checksumkind: CSK_MD5, 
checksum: "872e252efdfcb9480b4bfaf8437f58ab")

`producer: "clang version 10.0.0"` is enough.



Comment at: llvm/test/DebugInfo/X86/debug-info-template-align.ll:49
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, 
producer: "clang version 10.0.0 
(ssh://awpan...@idcvgits02.amd.com:29418/perfcompiler/er/llvm/cpu/clang 
8b3533f5560dd219a0e6d346be2190623822bada) (llvm/cpu/llvm 
61a342a7f3320d5517ba0bd012edc7cc908b36b7)", isOptimized: false, runtimeVersion: 
0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
+!1 = !DIFile(filename: 
"/home/awpandey/tools/llvm/tools/clang/test/CodeGenCXX/debug-info-template-align.cpp",
 directory: "/home/awpandey/tools/llvm/test/DebugInfo", checksumkind: CSK_MD5, 
checksum: "872e252efdfcb9480b4bfaf8437f58ab")
+!2 = !{}

Usually, we put an artificial name for the dir, e.g. `/dir`.



Comment at: llvm/test/DebugInfo/X86/debug-info-template-align.ll:54
+!5 = !{i32 1, !"wchar_size", i32 4}
+!6 = !{!"clang version 10.0.0 
(ssh://awpan...@idcvgits02.amd.com:29418/perfcompiler/er/llvm/cpu/clang 
8b3533f5560dd219a0e6d346be2190623822bada) (llvm/cpu/llvm 
61a342a7f3320d5517ba0bd012edc7cc908b36b7)"}
+!7 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 12, type: 
!9, scopeLine: 12, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: 
!0, retainedNodes: !2)

` "clang version 10.0.0"` is enough.



Comment at: llvm/test/DebugInfo/X86/debug-info-template-align.ll:56
+!7 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 12, type: 
!9, scopeLine: 12, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: 
!0, retainedNodes: !2)
+!8 = !DIFile(filename: 
"tools/clang/test/CodeGenCXX/debug-info-template-align.cpp", directory: 
"/home/awpandey/tools/llvm", checksumkind: CSK_MD5, checksum: 
"872e252efdfcb9480b4bfaf8437f58ab")
+!9 = !DISubroutineType(types: !10)

`filename: test.c, directory: "/dir"`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70111/new/

https://reviews.llvm.org/D70111



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69743: [CGDebugInfo] Emit subprograms for decls when AT_tail_call is understood

2019-11-04 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro accepted this revision.
djtodoro added a comment.
This revision is now accepted and ready to land.

@vsk Thanks for this!
(lgtm)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69743/new/

https://reviews.llvm.org/D69743



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >