[PATCH] D42551: [Debug] Add dbg.value intrinsics for PHIs created during LCSSA.

Matt Davis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 11:37:33 PST 2018


mattd created this revision.
mattd added a reviewer: mzolotukhin.

This patch is an enhancement to propagate dbg.value information when Phis are created on behalf of LCSSA.
I noticed a case where a value carried across a loop was reported as <optimized out>.

Specifically this case:

  int bar(int x, int y) {
    return x + y;
  }
  
  int foo(int size) {
    int val = 0;
    for (int i = 0; i < size; ++i) {
      val = bar(val, i);  // Both val and i are correct
    }
    return val; // <optimized out>
  }

In the above case, after all of the interesting computation completes our value
is reported as "optimized out." This change will add a dbg.value to correct this.

This patch also moves the dbg.value insertion routine from LoopRotation.cpp 
into Local.cpp, so that we can share it in both places (LoopRotation and LCSSA).


https://reviews.llvm.org/D42551

Files:
  include/llvm/Transforms/Utils/Local.h
  lib/Transforms/Scalar/LoopRotation.cpp
  lib/Transforms/Utils/LCSSA.cpp
  lib/Transforms/Utils/Local.cpp
  test/Transforms/LCSSA/basictest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42551.131489.patch
Type: text/x-patch
Size: 6576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180125/43cbd3f1/attachment-0001.bin>


More information about the llvm-commits mailing list