This is an archive of the discontinued LLVM Phabricator instance.

Change DEBUG() macro to LLVM_DEBUG() in Polly
ClosedPublic

Authored by Nicola on Mar 28 2018, 3:39 AM.

Details

Summary

The DEBUG() macro is too generic so it might clash with other projects.
This is going to be deprecated and replaced by LLVM_DEBUG() as soon as https://reviews.llvm.org/D43624 is submitted.

This is the command I used to do the replacement and formatting:
git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g'
git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM

Diff Detail

Repository
rPLO Polly

Event Timeline

Nicola created this revision.Mar 28 2018, 3:39 AM

Looks like the title is wrong but otherwise lgtm

Nicola updated this revision to Diff 140336.Mar 29 2018, 2:26 PM

I uploaded the wrong patch, sorry about that. I mixed up the patch file selection. This is the correct one for Polly.

Did you use the latest version of clang-format? Our unittests include a checking correct formatting and clang-format suggests the following changes:

--- C:/Users/Meinersbur/src/llvm/tools/polly/lib/CodeGen/PPCGCodeGeneration.cpp Fri Mar 30 11:50:07 2018
+++ -   Wed Dec 31 18:00:00 1969
@@ -3409,8 +3409,8 @@
         // Look for (<func-type>*) among operands of Inst
         if (auto PtrTy = dyn_cast<PointerType>(Op->getType())) {
           if (isa<FunctionType>(PtrTy->getElementType())) {
-            LLVM_DEBUG(dbgs() << Inst
-                              << " has illegal use of function in kernel.\n");
+            LLVM_DEBUG(dbgs()
+                       << Inst << " has illegal use of function in kernel.\n");
             return true;
           }
         }
@@ -3489,8 +3489,8 @@
       SplitBBTerm->setOperand(0, FalseI1);

       LLVM_DEBUG(dbgs() << "preloading invariant loads failed in function: " +
-                               S->getFunction().getName() + " | Scop Region: " +
-                               S->getNameStr());
+                               S->getFunction().getName() +
+                               " | Scop Region: " + S->getNameStr());
       // adjust the dominator tree accordingly.
       auto *ExitingBlock = StartBlock->getUniqueSuccessor();
       assert(ExitingBlock);

You can run ninja polly-update-format to apply automatically fix the formatting.

LLVM patch has not yet landed, so I did not test whether it compiles.

Otherwise, LGTM.

Nicola updated this revision to Diff 140775.Apr 3 2018, 7:02 AM

Updated diff with the latest clang-format. Thanks!

Meinersbur accepted this revision.May 14 2018, 3:19 PM

The patch doesn't apply cleanly anymore, but generally LGTM after r332240

This revision is now accepted and ready to land.May 14 2018, 3:19 PM
This revision was automatically updated to reflect the committed changes.