diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2016-12-15 20:01:26 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2016-12-15 20:01:26 +0000 |
commit | f20c57eca93f58e3d1cb4ea1be0448b46fb9b192 (patch) | |
tree | 1a24979fe092edb3877e151deee6fbaa9c6bd2d9 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 66d1f0ff1fb839678e23d56b7173befafe70bd3e (diff) | |
download | bcm5719-llvm-f20c57eca93f58e3d1cb4ea1be0448b46fb9b192.tar.gz bcm5719-llvm-f20c57eca93f58e3d1cb4ea1be0448b46fb9b192.zip |
[SimplifyCFG] Merge debug locations when hoisting an instruction from a then/else branch. NFC.
Now that a new API to merge debug locations has been committed at r289661 (see
review D26256 for more details), we can use it to "improve" the code added by
revision r280995.
Instead of nulling the debugloc of a commoned instruction, we use the 'merged'
debug location. At the moment, this is just a no functional change since
function `DILocation::getMergedLocation()` is just a stub and would always
return a null location.
Differential Revision: https://reviews.llvm.org/D27804
llvm-svn: 289862
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index c3e1b868f42..a47d0774fa7 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -34,7 +34,7 @@ #include "llvm/IR/ConstantRange.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" -#include "llvm/IR/DebugLoc.h" +#include "llvm/IR/DebugInfo.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/GlobalValue.h" #include "llvm/IR/GlobalVariable.h" @@ -1276,10 +1276,10 @@ static bool HoistThenElseCodeToIf(BranchInst *BI, // If the debug loc for I1 and I2 are different, as we are combining them // into one instruction, we do not want to select debug loc randomly from - // I1 or I2. Instead, we set the 0-line DebugLoc to note that we do not - // know the debug loc of the hoisted instruction. + // I1 or I2. if (!isa<CallInst>(I1) && I1->getDebugLoc() != I2->getDebugLoc()) - I1->setDebugLoc(DebugLoc()); + I1->setDebugLoc( + DILocation::getMergedLocation(I1->getDebugLoc(), I2->getDebugLoc())); I2->eraseFromParent(); Changed = true; |