diff --git a/llvm/tools/opt-viewer/opt-viewer.py b/llvm/tools/opt-viewer/opt-viewer.py index 5e5daf7feb0d..e6dd6a0286fe 100755 --- a/llvm/tools/opt-viewer/opt-viewer.py +++ b/llvm/tools/opt-viewer/opt-viewer.py @@ -178,7 +178,10 @@ def map_remarks(all_remarks): for arg in remark.Args: caller = arg.get('Caller') if caller: - context.caller_loc[caller] = arg['DebugLoc'] + try: + context.caller_loc[caller] = arg['DebugLoc'] + except KeyError: + pass def generate_report(all_remarks,