This is an archive of the discontinued LLVM Phabricator instance.

[LV][BUG] Tiny fix for printing debug locations for absolute paths.
ClosedPublic

Authored by zinovy.nis on Apr 25 2014, 9:05 AM.

Details

Summary

If a loop was defined in a file referenced by an absolute path (for ex. STL header from the system dir), then DEBUG print would print module dir and then that absolute path, which is wrong.

LV: Checking a loop in "Foo" from /home/myhome//usr/lib/gcc/z42_128-greencap-linux/1.2.3/../../../../include/c++/9.8.7/bits/list.tcc:171

The correct behavior is to just print the absolute path and skip module dir.

LV: Checking a loop in "Foo" from /usr/lib/gcc/z42_128-greencap-linux/1.2.3/../../../../include/c++/9.8.7/bits/list.tcc:171

Diff Detail

Event Timeline

zinovy.nis updated this revision to Diff 8849.Apr 25 2014, 9:05 AM
zinovy.nis retitled this revision from to [LV][BUG] Tiny fix for printing debug locations for absolute paths..
zinovy.nis updated this object.
zinovy.nis edited the test plan for this revision. (Show Details)
zinovy.nis added reviewers: echristo, nadav.
zinovy.nis set the repository for this revision to rL LLVM.
zinovy.nis added a subscriber: Unknown Object (MLST).
echristo accepted this revision.Apr 25 2014, 9:36 AM
echristo edited edge metadata.

Seems reasonable.

This revision is now accepted and ready to land.Apr 25 2014, 9:36 AM
zinovy.nis updated this revision to Diff 9077.EditedMay 5 2014, 8:16 AM
zinovy.nis edited edge metadata.
  1. Slightly refactored to get rid of ugly format<..> calls.
  2. Use path::append instead of string concatenation.
nadav edited edge metadata.May 5 2014, 9:13 AM

Zinovy,

Why is getDebugLocString defined in LoopVectorize.cpp? I am expecting other passes to also need this utility. Please refactor this function and put this function in a place where other passes would be able to use it.

Nadav

If factored out as a function accepting a DebugLoc rather than an llvm::Instruction, it may be mergable with most of printDebugLoc from lib/CodeGen/MachineInstr.cpp. The print format is not identical but I'm not sure if this is a problem.

zinovy.nis updated this revision to Diff 9106.May 6 2014, 3:31 AM
zinovy.nis edited edge metadata.

Thanks to Nadav and Yaron I refactored the code and significantly simplified it compared to my first patch. Also I added method 'print" to DebugLoc class which does the job.

Please re-review my new patch.

One small nit, otherwise LGTM.

-eric

lib/IR/DebugLoc.cpp
170 ↗(On Diff #9106)

Formatting looks wrong here.

zinovy.nis closed this revision.May 7 2014, 3:37 AM

Nadav, Eric thanks!