[llvm] debfb96 - llvm-reduce: Fix cloning unset maxCallFrameSize

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 15:28:55 PDT 2022


Author: Matt Arsenault
Date: 2022-04-22T18:28:45-04:00
New Revision: debfb96be62b43a9373b6a7478b5c4a87f8f7af4

URL: https://github.com/llvm/llvm-project/commit/debfb96be62b43a9373b6a7478b5c4a87f8f7af4
DIFF: https://github.com/llvm/llvm-project/commit/debfb96be62b43a9373b6a7478b5c4a87f8f7af4.diff

LOG: llvm-reduce: Fix cloning unset maxCallFrameSize

This was promoting an unset max call frame size to a max call frame
size of 0.

Added: 
    llvm/test/tools/llvm-reduce/mir/preserve-max-call-frame-size.mir

Modified: 
    llvm/tools/llvm-reduce/ReducerWorkItem.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-reduce/mir/preserve-max-call-frame-size.mir b/llvm/test/tools/llvm-reduce/mir/preserve-max-call-frame-size.mir
new file mode 100644
index 0000000000000..393232553b4d8
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/mir/preserve-max-call-frame-size.mir
@@ -0,0 +1,21 @@
+# REQUIRES: amdgpu-registered-target
+# RUN: llvm-reduce -simplify-mir -mtriple=amdgcn-amd-amdhsa --delta-passes=instructions --test FileCheck --test-arg --check-prefix=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t 2> %t.log
+# RUN: FileCheck --match-full-lines --check-prefix=RESULT %s < %t
+
+# CHECK-INTERESTINGNESS: S_ENDPGM
+
+# Make sure we preserve the default value of unset maxCallFrameSize,
+# and don't treat it as computed to 0.
+
+# RESULT: frameInfo:
+# RESULT-NOT: maxCallFrameSize
+---
+name: func
+tracksRegLiveness: true
+frameInfo:
+  maxCallFrameSize: 4294967295
+body:             |
+  bb.0:
+    S_NOP 0
+    S_ENDPGM 0
+...

diff  --git a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
index e12e81134cac2..0f953f5787972 100644
--- a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
+++ b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
@@ -49,7 +49,9 @@ static void cloneFrameInfo(
   DstMFI.setHasVAStart(SrcMFI.hasVAStart());
   DstMFI.setHasMustTailInVarArgFunc(SrcMFI.hasMustTailInVarArgFunc());
   DstMFI.setHasTailCall(SrcMFI.hasTailCall());
-  DstMFI.setMaxCallFrameSize(SrcMFI.getMaxCallFrameSize());
+
+  if (SrcMFI.isMaxCallFrameSizeComputed())
+    DstMFI.setMaxCallFrameSize(SrcMFI.getMaxCallFrameSize());
 
   DstMFI.setCVBytesOfCalleeSavedRegisters(
       SrcMFI.getCVBytesOfCalleeSavedRegisters());


        


More information about the llvm-commits mailing list