diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2016-10-17 11:32:26 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2016-10-17 11:32:26 +0000 |
commit | fa90c692db7c8a9e5f661ee0cdd4a4ca2f8985dd (patch) | |
tree | 9f2547aa87e0f599c53d77cf545ea953f9e3f35c /llvm/lib/CodeGen | |
parent | 17d566daaa4c26bf32ec5fe75ebc17ef68e1d4c6 (diff) | |
download | bcm5719-llvm-fa90c692db7c8a9e5f661ee0cdd4a4ca2f8985dd.tar.gz bcm5719-llvm-fa90c692db7c8a9e5f661ee0cdd4a4ca2f8985dd.zip |
[CodeGenPrepare] When moving a zext near to its associated load, do not retain the original debug location.
CodeGenPrepare knows how to move a zext of a load into the same basic block
where the load lives. The goal is to help ISel match a zero-extending load
instead of two separated instructions.
CGP attempts to move a zext computation even if it lives in a basic block that
does not post-dominate the load's basic block. That means, the hoisted zext may
be speculated. Preserving the zext location would hurt the debugging experience
and the quality of sample pgo.
With this patch, when moving a zext near to its associated load, CGP no longer
propagates the zext's debug location. Instead, CGP conservatively reuses the
same debug location for the load and the zext.
An alternative approach would be to assign an artificial line-0 location to the
zext. However we don't want to over-use the 'line-0' for this particular case
because it would have a size cost in the line-table section for no additional
benefit.
Differential Revision: https://reviews.llvm.org/D25611
llvm-svn: 284377
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index cc4af1efba6..62bc755ebab 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -4270,6 +4270,14 @@ bool CodeGenPrepare::moveExtToFormExtLoad(Instruction *&I) { TPT.commit(); I->removeFromParent(); I->insertAfter(LI); + // CGP does not check if the zext would be speculatively executed when moved + // to the same basic block as the load. Preserving its original location would + // pessimize the debugging experience, as well as negatively impact the + // quality of sample pgo. We don't want to use "line 0" as that has a + // size cost in the line-table section and logically the zext can be seen as + // part of the load. Therefore we conservatively reuse the same debug location + // for the load and the zext. + I->setDebugLoc(LI->getDebugLoc()); ++NumExtsMoved; return true; } |