[flang-commits] [flang] 715cde0 - [flang][nfc] Refine how output is defined in a test

Andrzej Warzynski via flang-commits flang-commits at lists.llvm.org
Wed Aug 30 06:39:10 PDT 2023


Author: Andrzej Warzynski
Date: 2023-08-30T13:37:28Z
New Revision: 715cde0a2558c6a2d3655af40234a958d0461d86

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

LOG: [flang][nfc] Refine how output is defined in a test

Updates optimization-remark.f90. Makes sure that every RUN line:
* discords the actual output of the compilation (we only care about the
  optimisation remarks),
* re-uses the same definition of the output (better code re-use),
* doesn't generate object files - no need to use `-c` if `-emit-llvm` is
  sufficient.

Differential Revision: https://reviews.llvm.org/D158951

Added: 
    

Modified: 
    flang/test/Driver/optimization-remark.f90

Removed: 
    


################################################################################
diff  --git a/flang/test/Driver/optimization-remark.f90 b/flang/test/Driver/optimization-remark.f90
index 3effaf1dc8ddd6..06cc133e8e42bf 100644
--- a/flang/test/Driver/optimization-remark.f90
+++ b/flang/test/Driver/optimization-remark.f90
@@ -2,23 +2,25 @@
 ! and -Rpass-analysis)
 ! loop-delete isn't enabled at O0 so we use at least O1
 
+! DEFINE: %{output} = -emit-llvm -o /dev/null 2>&1
+
 ! Check that we can override -Rpass= with -Rno-pass.
-! RUN: %flang_fc1 %s -O1 -Rpass -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=REMARKS
-! RUN: %flang_fc1 %s -O1 -Rpass -Rno-pass -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=NO-REMARKS
+! RUN: %flang_fc1 %s -O1 -Rpass %{output} | FileCheck %s --check-prefix=REMARKS
+! RUN: %flang_fc1 %s -O1 -Rpass -Rno-pass  %{output} | FileCheck %s --allow-empty --check-prefix=NO-REMARKS
 
 ! Check -Rno-pass, -Rno-pass-analysis, -Rno-pass-missed nothing emitted
-! RUN: %flang %s -O1 -Rno-pass -c 2>&1 | FileCheck %s --allow-empty --check-prefix=NO-REMARKS
-! RUN: %flang %s -O1 -Rno-pass-missed -c 2>&1 | FileCheck %s --allow-empty --check-prefix=NO-REMARKS
-! RUN: %flang %s -O1 -Rno-pass-analysis -c 2>&1 | FileCheck %s --allow-empty --check-prefix=NO-REMARKS
+! RUN: %flang %s -O1 -Rno-pass -S %{output} | FileCheck %s --allow-empty --check-prefix=NO-REMARKS
+! RUN: %flang %s -O1 -Rno-pass-missed -S %{output}  | FileCheck %s --allow-empty --check-prefix=NO-REMARKS
+! RUN: %flang %s -O1 -Rno-pass-analysis -S %{output} | FileCheck %s --allow-empty --check-prefix=NO-REMARKS
 
 ! Check full -Rpass message is emitted
-! RUN: %flang %s -O1 -Rpass -c 2>&1 | FileCheck %s
+! RUN: %flang %s -O1 -Rpass  -S %{output} | FileCheck %s
 
 ! Check full -Rpass-missed message is emitted
-! RUN: %flang %s -O1 -Rpass-missed -c 2>&1 | FileCheck %s --check-prefix=REMARKS-MISSED
+! RUN: %flang %s -O1 -Rpass-missed  -S %{output} | FileCheck %s --check-prefix=REMARKS-MISSED
 
 ! Check full -Rpass-analysis message is emitted
-! RUN: %flang %s -O1 -Rpass-analysis -c 2>&1 | FileCheck %s --check-prefix=REMARKS-ANALYSIS
+! RUN: %flang %s -O1 -Rpass-analysis  -S %{output} | FileCheck %s --check-prefix=REMARKS-ANALYSIS
 
 ! CHECK: remark: Loop deleted because it is invariant
 ! REMARKS-MISSED: {{.*}} will not be inlined into {{.*}} because its definition is unavailable


        


More information about the flang-commits mailing list