[PATCH] D45728: [Polly] Allow arbitrary function calls for debugging purposes.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 17 10:41:14 PDT 2018


Meinersbur created this revision.
Meinersbur added reviewers: grosser, philip.pfaffe, jdoerfert.
Meinersbur added a project: Polly.
Herald added a reviewer: bollu.

Add the switch `-polly-debug-func` to define the name of a debug function. This function is ignored for any validity check.

Its purpose is to allow to observe a value after transformation by a SCoP, and to follow which statements are executed in which order. For instance, consider the following code:

  static void dbg_printf(int sum, int i) {
    fprintf(stderr, "The value of sum is %d, i=%d\n", sum, i);
    fflush(stderr);
  }
  
  void func(int n) {
    int sum = 0;
    for (int i = 0; i < 16; i+=1) {
      sum += i;
      dbg_printf(sum, i);
    }
  }

Executing this after Polly's codegen reveals the new execution order and the assumed values at that point of execution.


Repository:
  rPLO Polly

https://reviews.llvm.org/D45728

Files:
  include/polly/Support/ScopHelper.h
  lib/Analysis/ScopBuilder.cpp
  lib/Analysis/ScopDetection.cpp
  lib/Analysis/ScopInfo.cpp
  lib/Support/ScopHelper.cpp
  test/ScopInfo/debug_call.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45728.142798.patch
Type: text/x-patch
Size: 6228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180417/3d3c914b/attachment.bin>


More information about the llvm-commits mailing list