-
Notifications
You must be signed in to change notification settings - Fork 14k
[Remarks] Elaborate on called intrinsics #143985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-llvm-ir Author: Jon Roelofs (jroelofs) ChangesFull diff: https://github.com/llvm/llvm-project/pull/143985.diff 2 Files Affected:
diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp
index 0f1291b8bd8be..b94dcace5e3c7 100644
--- a/llvm/lib/IR/DiagnosticInfo.cpp
+++ b/llvm/lib/IR/DiagnosticInfo.cpp
@@ -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"
@@ -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)) {
diff --git a/llvm/test/Transforms/GVN/opt-remarks.ll b/llvm/test/Transforms/GVN/opt-remarks.ll
index 7c3f16917bc97..8fb2d5756f95d 100644
--- a/llvm/test/Transforms/GVN/opt-remarks.ll
+++ b/llvm/test/Transforms/GVN/opt-remarks.ll
@@ -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:
@@ -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}
|
@llvm/pr-subscribers-llvm-transforms Author: Jon Roelofs (jroelofs) ChangesFull diff: https://github.com/llvm/llvm-project/pull/143985.diff 2 Files Affected:
diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp
index 0f1291b8bd8be..b94dcace5e3c7 100644
--- a/llvm/lib/IR/DiagnosticInfo.cpp
+++ b/llvm/lib/IR/DiagnosticInfo.cpp
@@ -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"
@@ -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)) {
diff --git a/llvm/test/Transforms/GVN/opt-remarks.ll b/llvm/test/Transforms/GVN/opt-remarks.ll
index 7c3f16917bc97..8fb2d5756f95d 100644
--- a/llvm/test/Transforms/GVN/opt-remarks.ll
+++ b/llvm/test/Transforms/GVN/opt-remarks.ll
@@ -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:
@@ -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}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/137/builds/20534 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/175/builds/20475 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/33/builds/18466 Here is the relevant piece of the build log for the reference
|
folllow-up in 4943e74 |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/185/builds/20323 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/35109 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/60/builds/30505 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/16/builds/20999 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/56/builds/28659 Here is the relevant piece of the build log for the reference
|
No description provided.