llvm.org GIT mirror llvm / 2f8f1d3
Delete -std-compile-opts. These days -std-compile-opts was just a silly alias for -O3. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219951 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
18 changed file(s) with 43 addition(s) and 107 deletion(s). Raw diff Collapse all Expand all
6161 available. The order in which the options occur on the command line are the
6262 order in which they are executed (within pass constraints).
6363
64 .. option:: -std-compile-opts
65
66 This is short hand for a standard list of *compile time optimization* passes.
67 It might be useful for other front end compilers as well. To discover the
68 full set of options available, use the following command:
69
70 .. code-block:: sh
71
72 llvm-as < /dev/null | opt -std-compile-opts -disable-output -debug-pass=Arguments
73
7464 .. option:: -disable-inlining
7565
76 This option is only meaningful when :option:`-std-compile-opts` is given. It
77 simply removes the inlining pass from the standard list.
66 This option simply removes the inlining pass from the standard list.
7867
7968 .. option:: -disable-opt
8069
81 This option is only meaningful when :option:`-std-compile-opts` is given. It
82 disables most, but not all, of the :option:`-std-compile-opts`. The ones that
83 remain are :option:`-verify`, :option:`-lower-setjmp`, and
84 :option:`-funcresolve`.
70 This option is only meaningful when :option:`-std-link-opts` is given. It
71 disables most passes.
8572
8673 .. option:: -strip-debug
8774
9481 This option causes opt to add a verify pass after every pass otherwise
9582 specified on the command line (including :option:`-verify`). This is useful
9683 for cases where it is suspected that a pass is creating an invalid module but
97 it is not clear which pass is doing it. The combination of
98 :option:`-std-compile-opts` and :option:`-verify-each` can quickly track down
99 this kind of problem.
84 it is not clear which pass is doing it.
10085
10186 .. option:: -stats
10287
8888
8989 .. code-block:: bash
9090
91 opt -std-compile-opts -debug-pass=Arguments foo.bc -disable-output
91 opt -O3 -debug-pass=Arguments foo.bc -disable-output
9292
9393 This command should do two things: it should print out a list of passes, and
9494 then it should crash in the same way as clang. If it doesn't crash, please
732732 return ((a & (c - 1)) != 0) | ((b & (c - 1)) != 0);
733733 }
734734 Both should combine to ((a|b) & (c-1)) != 0. Currently not optimized with
735 "clang -emit-llvm-bc | opt -std-compile-opts".
735 "clang -emit-llvm-bc | opt -O3".
736736
737737 //===---------------------------------------------------------------------===//
738738
745745 }
746746 The expression should optimize to something like
747747 "!((start|end)&~PMD_MASK). Currently not optimized with "clang
748 -emit-llvm-bc | opt -std-compile-opts".
748 -emit-llvm-bc | opt -O3".
749749
750750 //===---------------------------------------------------------------------===//
751751
764764 return (abs(x)) >= 0;
765765 }
766766 This should optimize to x == INT_MIN. (With -fwrapv.) Currently not
767 optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
767 optimized with "clang -emit-llvm-bc | opt -O3".
768768
769769 //===---------------------------------------------------------------------===//
770770
802802
803803 All should simplify to a single comparison. All of these are
804804 currently not optimized with "clang -emit-llvm-bc | opt
805 -std-compile-opts".
805 -O3".
806806
807807 //===---------------------------------------------------------------------===//
808808
809809 From GCC Bug 32605:
810810 int c(int* x) {return (char*)x+2 == (char*)x;}
811811 Should combine to 0. Currently not optimized with "clang
812 -emit-llvm-bc | opt -std-compile-opts" (although llc can optimize it).
812 -emit-llvm-bc | opt -O3" (although llc can optimize it).
813813
814814 //===---------------------------------------------------------------------===//
815815
816816 int a(unsigned b) {return ((b << 31) | (b << 30)) >> 31;}
817817 Should be combined to "((b >> 1) | b) & 1". Currently not optimized
818 with "clang -emit-llvm-bc | opt -std-compile-opts".
818 with "clang -emit-llvm-bc | opt -O3".
819819
820820 //===---------------------------------------------------------------------===//
821821
822822 unsigned a(unsigned x, unsigned y) { return x | (y & 1) | (y & 2);}
823823 Should combine to "x | (y & 3)". Currently not optimized with "clang
824 -emit-llvm-bc | opt -std-compile-opts".
824 -emit-llvm-bc | opt -O3".
825825
826826 //===---------------------------------------------------------------------===//
827827
828828 int a(int a, int b, int c) {return (~a & c) | ((c|a) & b);}
829829 Should fold to "(~a & c) | (a & b)". Currently not optimized with
830 "clang -emit-llvm-bc | opt -std-compile-opts".
830 "clang -emit-llvm-bc | opt -O3".
831831
832832 //===---------------------------------------------------------------------===//
833833
834834 int a(int a,int b) {return (~(a|b))|a;}
835835 Should fold to "a|~b". Currently not optimized with "clang
836 -emit-llvm-bc | opt -std-compile-opts".
836 -emit-llvm-bc | opt -O3".
837837
838838 //===---------------------------------------------------------------------===//
839839
840840 int a(int a, int b) {return (a&&b) || (a&&!b);}
841841 Should fold to "a". Currently not optimized with "clang -emit-llvm-bc
842 | opt -std-compile-opts".
842 | opt -O3".
843843
844844 //===---------------------------------------------------------------------===//
845845
846846 int a(int a, int b, int c) {return (a&&b) || (!a&&c);}
847847 Should fold to "a ? b : c", or at least something sane. Currently not
848 optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
848 optimized with "clang -emit-llvm-bc | opt -O3".
849849
850850 //===---------------------------------------------------------------------===//
851851
852852 int a(int a, int b, int c) {return (a&&b) || (a&&c) || (a&&b&&c);}
853853 Should fold to a && (b || c). Currently not optimized with "clang
854 -emit-llvm-bc | opt -std-compile-opts".
854 -emit-llvm-bc | opt -O3".
855855
856856 //===---------------------------------------------------------------------===//
857857
858858 int a(int x) {return x | ((x & 8) ^ 8);}
859859 Should combine to x | 8. Currently not optimized with "clang
860 -emit-llvm-bc | opt -std-compile-opts".
860 -emit-llvm-bc | opt -O3".
861861
862862 //===---------------------------------------------------------------------===//
863863
864864 int a(int x) {return x ^ ((x & 8) ^ 8);}
865865 Should also combine to x | 8. Currently not optimized with "clang
866 -emit-llvm-bc | opt -std-compile-opts".
866 -emit-llvm-bc | opt -O3".
867867
868868 //===---------------------------------------------------------------------===//
869869
870870 int a(int x) {return ((x | -9) ^ 8) & x;}
871871 Should combine to x & -9. Currently not optimized with "clang
872 -emit-llvm-bc | opt -std-compile-opts".
872 -emit-llvm-bc | opt -O3".
873873
874874 //===---------------------------------------------------------------------===//
875875
876876 unsigned a(unsigned a) {return a * 0x11111111 >> 28 & 1;}
877877 Should combine to "a * 0x88888888 >> 31". Currently not optimized
878 with "clang -emit-llvm-bc | opt -std-compile-opts".
878 with "clang -emit-llvm-bc | opt -O3".
879879
880880 //===---------------------------------------------------------------------===//
881881
882882 unsigned a(char* x) {if ((*x & 32) == 0) return b();}
883883 There's an unnecessary zext in the generated code with "clang
884 -emit-llvm-bc | opt -std-compile-opts".
884 -emit-llvm-bc | opt -O3".
885885
886886 //===---------------------------------------------------------------------===//
887887
888888 unsigned a(unsigned long long x) {return 40 * (x >> 1);}
889889 Should combine to "20 * (((unsigned)x) & -2)". Currently not
890 optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
890 optimized with "clang -emit-llvm-bc | opt -O3".
891891
892892 //===---------------------------------------------------------------------===//
893893
894894 int g(int x) { return (x - 10) < 0; }
895895 Should combine to "x <= 9" (the sub has nsw). Currently not
896 optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
896 optimized with "clang -emit-llvm-bc | opt -O3".
897897
898898 //===---------------------------------------------------------------------===//
899899
900900 int g(int x) { return (x + 10) < 0; }
901901 Should combine to "x < -10" (the add has nsw). Currently not
902 optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
902 optimized with "clang -emit-llvm-bc | opt -O3".
903903
904904 //===---------------------------------------------------------------------===//
905905
906906 int f(int i, int j) { return i < j + 1; }
907907 int g(int i, int j) { return j > i - 1; }
908908 Should combine to "i <= j" (the add/sub has nsw). Currently not
909 optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
909 optimized with "clang -emit-llvm-bc | opt -O3".
910910
911911 //===---------------------------------------------------------------------===//
912912
913913 unsigned f(unsigned x) { return ((x & 7) + 1) & 15; }
914914 The & 15 part should be optimized away, it doesn't change the result. Currently
915 not optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
915 not optimized with "clang -emit-llvm-bc | opt -O3".
916916
917917 //===---------------------------------------------------------------------===//
918918
None ; RUN: opt < %s -std-compile-opts -S | FileCheck %s
0 ; RUN: opt < %s -O3 -S | FileCheck %s
11 ; ModuleID = 'small2.c'
22 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
33 target triple = "i386-apple-darwin8"
None ; RUN: opt -std-compile-opts < %s | llvm-dis | not grep badref
0 ; RUN: opt -O3 < %s | llvm-dis | not grep badref
11 ; RUN: verify-uselistorder %s
22
33 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
None ; RUN: opt < %s -std-compile-opts | llc > %t
0 ; RUN: opt < %s -O3 | llc > %t
11 ; ModuleID = 'ld3.c'
22 target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
33 target triple = "powerpc-apple-darwin8"
None ; RUN: opt < %s -std-compile-opts | \
0 ; RUN: opt < %s -O3 | \
11 ; RUN: llc -mtriple=thumbv7-apple-darwin10 -mattr=+neon | FileCheck %s
22
33 define void @fred(i32 %three_by_three, i8* %in, double %dt1, i32 %x_size, i32 %y_size, i8* %bp) nounwind {
None ; RUN: opt < %s -std-compile-opts | llc -no-integrated-as
0 ; RUN: opt < %s -O3 | llc -no-integrated-as
11 ; ModuleID = 'block12.c'
22 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
33 target triple = "i686-apple-darwin8"
33 ; RUN: llc -mtriple x86_64-pc-mingw32 -O0 < %s | FileCheck %s -check-prefix=FAST
44 ; PR6275
55 ;
6 ; RUN: opt -mtriple x86_64-pc-win32 -std-compile-opts -S < %s | FileCheck %s -check-prefix=OPT
6 ; RUN: opt -mtriple x86_64-pc-win32 -O3 -S < %s | FileCheck %s -check-prefix=OPT
77
88 @Var1 = external dllimport global i32
99 @Var2 = available_externally dllimport unnamed_addr constant i32 1
33 ; RUN: llc -mtriple i386-pc-mingw32 -O0 < %s | FileCheck %s -check-prefix=FAST
44 ; PR6275
55 ;
6 ; RUN: opt -mtriple i386-pc-win32 -std-compile-opts -S < %s | FileCheck %s -check-prefix=OPT
6 ; RUN: opt -mtriple i386-pc-win32 -O3 -S < %s | FileCheck %s -check-prefix=OPT
77
88 @Var1 = external dllimport global i32
99 @Var2 = available_externally dllimport unnamed_addr constant i32 1
None ; RUN: opt < %s -std-compile-opts | llc > %t
0 ; RUN: opt < %s -O3 | llc > %t
11 ; RUN: grep 2147027116 %t | count 3
22 ; RUN: grep 2147228864 %t | count 3
33 ; RUN: grep 2146502828 %t | count 3
None ; RUN: opt < %s -std-compile-opts -S > %t
0 ; RUN: opt < %s -O3 -S > %t
11 ; RUN: grep undef %t | count 1
22 ; RUN: grep 5 %t | count 1
33 ; RUN: grep 7 %t | count 1
None ; RUN: opt < %s -std-compile-opts -o - | llc -no-integrated-as -o - | grep bork_directive | wc -l | grep 2
0 ; RUN: opt < %s -O3 -o - | llc -no-integrated-as -o - | grep bork_directive | wc -l | grep 2
11
22 ;; We don't want branch folding to fold asm directives.
33
0 ; RUN: opt < %s -instcombine -S | not grep call
1 ; RUN: opt < %s -std-compile-opts -S | not grep xyz
1 ; RUN: opt < %s -O3 -S | not grep xyz
22 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
33
44 @.str = internal constant [4 x i8] c"xyz\00" ; <[4 x i8]*> [#uses=1]
None ; RUN: opt < %s -std-compile-opts -S | grep volatile | count 3
0 ; RUN: opt < %s -O3 -S | grep volatile | count 3
11 ; PR1520
22 ; Don't promote load volatiles/stores. This is really needed to handle setjmp/lonjmp properly.
33
6262 PassList(cl::desc("Passes available:"), cl::ZeroOrMore);
6363
6464 static cl::opt
65 StandardCompileOpts("std-compile-opts",
66 cl::desc("Include the standard compile time optimizations"));
67
68 static cl::opt
6965 StandardLinkOpts("std-link-opts",
7066 cl::desc("Include the standard link time optimizations"));
7167
169165 if (D.addSources(InputFilenames)) return 1;
170166
171167 AddToDriver PM(D);
172 if (StandardCompileOpts) {
173 PassManagerBuilder Builder;
174 Builder.OptLevel = 3;
175 Builder.Inliner = createFunctionInliningPass();
176 Builder.populateModulePassManager(PM);
177 }
178168
179169 if (StandardLinkOpts) {
180170 PassManagerBuilder Builder;
108108 cl::desc("Do not run any optimization passes"));
109109
110110 static cl::opt
111 StandardCompileOpts("std-compile-opts",
112 cl::desc("Include the standard compile time optimizations"));
113
114 static cl::opt
115111 StandardLinkOpts("std-link-opts",
116112 cl::desc("Include the standard link time optimizations"));
117113
230226
231227 Builder.populateFunctionPassManager(FPM);
232228 Builder.populateModulePassManager(MPM);
233 }
234
235 static void AddStandardCompilePasses(PassManagerBase &PM) {
236 PM.add(createVerifierPass()); // Verify that input is correct
237
238 // If the -strip-debug command line option was specified, do it.
239 if (StripDebug)
240 addPass(PM, createStripSymbolsPass(true));
241
242 // Verify debug info only after it's (possibly) stripped.
243 PM.add(createDebugInfoVerifierPass());
244
245 if (DisableOptimizations) return;
246
247 // -std-compile-opts adds the same module passes as -O3.
248 PassManagerBuilder Builder;
249 if (!DisableInline)
250 Builder.Inliner = createFunctionInliningPass();
251 Builder.OptLevel = 3;
252 Builder.populateModulePassManager(PM);
253229 }
254230
255231 static void AddStandardLinkPasses(PassManagerBase &PM) {
478454 NoOutput = true;
479455 }
480456
481 // If the -strip-debug command line option was specified, add it. If
482 // -std-compile-opts was also specified, it will handle StripDebug.
483 if (StripDebug && !StandardCompileOpts)
457 // If the -strip-debug command line option was specified, add it.
458 if (StripDebug)
484459 addPass(Passes, createStripSymbolsPass(true));
485460
486461 // Create a new optimization pass for each one specified on the command line
487462 for (unsigned i = 0; i < PassList.size(); ++i) {
488 // Check to see if -std-compile-opts was specified before this option. If
489 // so, handle it.
490 if (StandardCompileOpts &&
491 StandardCompileOpts.getPosition() < PassList.getPosition(i)) {
492 AddStandardCompilePasses(Passes);
493 StandardCompileOpts = false;
494 }
495
496463 if (StandardLinkOpts &&
497464 StandardLinkOpts.getPosition() < PassList.getPosition(i)) {
498465 AddStandardLinkPasses(Passes);
565532 Passes.add(createPrintModulePass(errs()));
566533 }
567534
568 // If -std-compile-opts was specified at the end of the pass list, add them.
569 if (StandardCompileOpts) {
570 AddStandardCompilePasses(Passes);
571 StandardCompileOpts = false;
572 }
573
574535 if (StandardLinkOpts) {
575536 AddStandardLinkPasses(Passes);
576537 StandardLinkOpts = false;
7373 echo " Optimized program: $optprog"
7474
7575 # Define the list of optimizations to run. This comprises the same set of
76 # optimizations that opt -std-compile-opts and gccld run, in the same order.
77 opt_switches=`llvm-as < /dev/null -o - | opt -std-compile-opts -disable-output -debug-pass=Arguments 2>&1 | sed 's/Pass Arguments: //'`
76 # optimizations that opt -O3 runs, in the same order.
77 opt_switches=`llvm-as < /dev/null -o - | opt -O3 -disable-output -debug-pass=Arguments 2>&1 | sed 's/Pass Arguments: //'`
7878 all_switches="$opt_switches"
7979 echo "Passes : $all_switches"
8080