[PATCH] [CodeGen] Reuse stack space from unused function results

Reid Kleckner rnk at google.com
Wed May 13 11:01:32 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: test/CodeGenCXX/stack-reuse.cpp:1
@@ +1,2 @@
+// RUN: %clang -target armv7l-unknown-linux-gnueabihf -O3 -S %s -o - -emit-llvm | FileCheck %s --check-prefix=LIFETIME
+// RUN: %clang -target armv7l-unknown-linux-gnueabihf -O3 -S %s -o - | FileCheck %s --check-prefix=ASM
----------------
The IR test doesn't need -O3, just -O1 -disable-llvm-optzns. It's better to keep the test as isolated from LLVM changes as possible.

================
Comment at: test/CodeGenCXX/stack-reuse.cpp:2
@@ +1,3 @@
+// RUN: %clang -target armv7l-unknown-linux-gnueabihf -O3 -S %s -o - -emit-llvm | FileCheck %s --check-prefix=LIFETIME
+// RUN: %clang -target armv7l-unknown-linux-gnueabihf -O3 -S %s -o - | FileCheck %s --check-prefix=ASM
+
----------------
We should drop the integration test here and assume that LLVM does the right thing when the lifetime markers are right. This test will fail if the ARM backend is compiled out, but the IR test is portable. I'd rather have a test that runs everywhere instead of one that runs sometimes and breaks when LLVM changes a little.

================
Comment at: test/CodeGenCXX/stack-reuse.cpp:30
@@ +29,3 @@
+// LIFETIME-LABEL: define void @small_rvoed_unnamed_temporary_object
+// LIFETIME: call void @llvm.lifetime.start
+// LIFETIME: call void @llvm.lifetime.end
----------------
I'd throw in a check for `call void @foo_small` between the lifetimes.

http://reviews.llvm.org/D9743

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list