Skip to content

Comments

Dummy pass#1

Open
anamaoh wants to merge 3 commits intomainfrom
dummy-pass
Open

Dummy pass#1
anamaoh wants to merge 3 commits intomainfrom
dummy-pass

Conversation

@anamaoh
Copy link
Owner

@anamaoh anamaoh commented Oct 29, 2025

No description provided.

.gitignore Outdated

# Nested build directory
/build*
/build*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert unnecessary whitespace changes.

foo_00.ll Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file used for something?


namespace llvm {

class DebugRecordCounterPass : public PassInfoMixin<DebugRecordCounterPass> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format all added code using git-clang-format.

endif()

# Component post-processing
# Component post-processing

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary extra whitespace.

#include "llvm/Transforms/Vectorize/SLPVectorizer.h"
#include "llvm/Transforms/Vectorize/VectorCombine.h"

#include "llvm/Transforms/Utils/DebugRecordDeleter.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This include can be grouped with the previous ones.


if (isLTOPreLink(Phase))
addRequiredLTOPreLinkPasses(MPM);
addRequiredLTOPreLinkPasses(MPM);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra whitespace.

// build/bin/opt -disable-output /home/ana-marija/Documents/foo_00.ll -passes=dbg-counter
PreservedAnalyses DebugRecordCounterPass::run(Module &M, ModuleAnalysisManager &AM) {

int dbg_values, dbg_declares, dbg_assigns;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be declared as unsigned

int dbg_values, dbg_declares, dbg_assigns;

for (Function &F : M) {
errs() << "Function: " << F.getName() << "\n";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Investigate the LLVM_DEBUG macro to print output only when specified by the -debug-only=[name] option.


return PreservedAnalyses::all();

} No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a missing newline at the end of this and some other files.

PreservedAnalyses DebugRecordDeleterPass::run(Module &M,
ModuleAnalysisManager &AM) {

bool modified = StripDebugInfo(M);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will remove all debug information, not just the debug record instructions. Also, modified is unused.

!33 = !DILocation(line: 13, column: 6, scope: !31)
!34 = !DILocation(line: 13, column: 10, scope: !31)
!35 = !DILocation(line: 14, column: 9, scope: !31)
!36 = !DILocation(line: 14, column: 2, scope: !31) No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are missing newlines at the end of test files.

!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "s", scope: !2, file: !5, line: 8, type: !6, isLocal: false, isDefinition: true)
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 22.0.0git (https://github.com/anamaoh/llvm-project.git 782a91e1fc94d9c82495f60afc5ed5edd72de776)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
!3 = !DIFile(filename: "/home/ana-marija/Documents/load.cpp", directory: "/home/ana-marija/Desktop/LLVM/llvm-project", checksumkind: CSK_MD5, checksum: "1bce1e274606359bd3ee799e44db5ab7")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use dummy paths throughout tests. Consult DebugInfo tests for reference.

Comment on lines 5 to 6
#define DEBUG_TYPE "counter"
#include "llvm/Support/Debug.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEBUG_TYPE should be defined after all includes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants