Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions llvm/lib/IR/DiagnosticInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
Expand Down Expand Up @@ -211,6 +212,9 @@ DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key,
else if (isa<Constant>(V)) {
raw_string_ostream OS(Val);
V->printAsOperand(OS, /*PrintType=*/false);
} else if (auto *II = dyn_cast<IntrinsicInst>(V)) {
raw_string_ostream OS(Val);
OS << "call " << II->getCalledFunction()->getName();
} else if (auto *I = dyn_cast<Instruction>(V)) {
Val = I->getOpcodeName();
} else if (auto *MD = dyn_cast<MetadataAsValue>(V)) {
Expand Down
22 changes: 22 additions & 0 deletions llvm/test/Transforms/GVN/opt-remarks.ll
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@
; YAML-NEXT: - ClobberedBy: store
; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 2, Column: 10 }
; YAML-NEXT: ...
; YAML-NEXT: --- !Missed
; YAML-NEXT: Pass: gvn
; YAML-NEXT: Name: LoadClobbered
; YAML-NEXT: Function: lifetime_end
; YAML-NEXT: Args:
; YAML-NEXT: - String: 'load of type '
; YAML-NEXT: - Type: i8
; YAML-NEXT: - String: ' not eliminated'
; YAML-NEXT: - String: ' in favor of '
; YAML-NEXT: - OtherAccess: store
; YAML-NEXT: - String: ' because it is clobbered by '
; YAML-NEXT: - ClobberedBy: call llvm.lifetime.end.p0
; YAML-NEXT: ...

define i32 @arg(ptr %p, i32 %i) {
entry:
Expand Down Expand Up @@ -93,6 +106,15 @@ entry:
%add = add i32 %load1, %load
ret i32 %add
}

define i8 @lifetime_end(ptr %p, i8 %val) {
call void @llvm.lifetime.start.p0(i64 32, ptr %p)
store i8 %val, ptr %p
call void @llvm.lifetime.end.p0(i64 32, ptr %p)
%1 = load i8, ptr %p
ret i8 %1
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5}
!llvm.ident = !{!6}
Expand Down
Loading