[PATCH] D99107: [clang][CodeGen] Do not emit NVRO debug helper when not emitting debug info

Nikita Kniazev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 22 12:59:05 PDT 2021


nick created this revision.
nick added reviewers: akhuang, rnk, aprantl.
nick requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When no debug information is emitted there is no point in emitting a hack introduced in D63361 <https://reviews.llvm.org/D63361>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99107

Files:
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/test/CodeGen/arm64-microsoft-arguments.cpp


Index: clang/test/CodeGen/arm64-microsoft-arguments.cpp
===================================================================
--- clang/test/CodeGen/arm64-microsoft-arguments.cpp
+++ clang/test/CodeGen/arm64-microsoft-arguments.cpp
@@ -43,7 +43,7 @@
 // Pass and return aggregate (of size < 16 bytes) with non-trivial destructor.
 // Passed directly but returned indirectly.
 // CHECK: define {{.*}} void {{.*}}f4{{.*}}(%struct.S4* inreg noalias sret(%struct.S4) align 4 %agg.result)
-// CHECK: call void {{.*}}func4{{.*}}(%struct.S4* inreg sret(%struct.S4) align 4 %agg.result, [2 x i64] %5)
+// CHECK: call void {{.*}}func4{{.*}}(%struct.S4* inreg sret(%struct.S4) align 4 %agg.result, [2 x i64] %4)
 struct S4 {
   int a[3];
   ~S4();
@@ -57,7 +57,7 @@
 
 // Pass and return from instance method called from instance method.
 // CHECK: define {{.*}} void @{{.*}}bar at Q1{{.*}}(%class.Q1* {{[^,]*}} %this, %class.P1* inreg noalias sret(%class.P1) align 1 %agg.result)
-// CHECK: call void {{.*}}foo at P1{{.*}}(%class.P1* {{[^,]*}} %ref.tmp, %class.P1* inreg sret(%class.P1) align 1 %agg.result, i8 %1)
+// CHECK: call void {{.*}}foo at P1{{.*}}(%class.P1* {{[^,]*}} %ref.tmp, %class.P1* inreg sret(%class.P1) align 1 %agg.result, i8 %0)
 
 class P1 {
 public:
Index: clang/lib/CodeGen/CodeGenFunction.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenFunction.cpp
+++ clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1055,7 +1055,8 @@
     if (CurFnInfo->getReturnInfo().isSRetAfterThis())
       ++AI;
     ReturnValue = Address(&*AI, CurFnInfo->getReturnInfo().getIndirectAlign());
-    if (!CurFnInfo->getReturnInfo().getIndirectByVal()) {
+    if (getDebugInfo() && CGM.getCodeGenOpts().hasReducedDebugInfo() &&
+        !CurFnInfo->getReturnInfo().getIndirectByVal()) {
       ReturnValuePointer =
           CreateDefaultAlignTempAlloca(Int8PtrTy, "result.ptr");
       Builder.CreateStore(Builder.CreatePointerBitCastOrAddrSpaceCast(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99107.332398.patch
Type: text/x-patch
Size: 1978 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210322/50d564f4/attachment.bin>


More information about the cfe-commits mailing list