diff options
| author | Vedant Kumar <vsk@apple.com> | 2018-04-12 20:58:24 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2018-04-12 20:58:24 +0000 |
| commit | 65b0d4df200d407095b7a89f71bb674608d2da17 (patch) | |
| tree | 69e382fa736c1e80bb3f4c627b30f02892264768 /llvm/lib | |
| parent | 49331246b68459daa3f66c076d553e6168a67650 (diff) | |
| download | bcm5719-llvm-65b0d4df200d407095b7a89f71bb674608d2da17.tar.gz bcm5719-llvm-65b0d4df200d407095b7a89f71bb674608d2da17.zip | |
[DebugInfo] Create merged locations for instructions other than calls
This lifts a restriction on DILocation::getMergedLocation(), allowing it
to create merged locations for instructions other than calls.
Instruction::applyMergedLocation() now defaults to creating merged
locations for all instructions.
The default behavior of getMergedLocation() is unchanged: callers which
invoke it directly are unaffected.
This change will enable a follow-up Mem2Reg fix which improves crash
reporting.
Differential Revision: https://reviews.llvm.org/D45396
llvm-svn: 329955
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 3 | ||||
| -rw-r--r-- | llvm/lib/IR/DebugInfoMetadata.cpp | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 2402e01f5f1..ca2dad306b4 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -675,7 +675,8 @@ unsigned llvm::getDebugMetadataVersionFromModule(const Module &M) { void Instruction::applyMergedLocation(const DILocation *LocA, const DILocation *LocB) { - setDebugLoc(DILocation::getMergedLocation(LocA, LocB, this)); + setDebugLoc(DILocation::getMergedLocation(LocA, LocB, + DILocation::WithGeneratedLocation)); } //===----------------------------------------------------------------------===// diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index c1a9f3f6929..fe57aa7442a 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -68,16 +68,16 @@ DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line, Storage, Context.pImpl->DILocations); } -const DILocation * -DILocation::getMergedLocation(const DILocation *LocA, const DILocation *LocB, - const Instruction *ForInst) { +const DILocation *DILocation::getMergedLocation(const DILocation *LocA, + const DILocation *LocB, + bool GenerateLocation) { if (!LocA || !LocB) return nullptr; if (LocA == LocB || !LocA->canDiscriminate(*LocB)) return LocA; - if (!dyn_cast_or_null<CallInst>(ForInst)) + if (!GenerateLocation) return nullptr; SmallPtrSet<DILocation *, 5> InlinedLocationsA; |

