Commit 42a7f2408f83fd18c9ad0f3691094423113aaedc

Authored by Pierre Cwik
1 parent ac45592e

optimisation 19 mai

a.out 0 → 100755
No preview for this file type
code_mort 0 → 100755
No preview for this file type
code_mort.c 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +#include <stdio.h>
  2 +int main(void){
  3 +int a=0;
  4 +if(a==2) printf("Bonjour \n");
  5 +printf("Coucou !\n");
  6 +a=1;
  7 +return a;
  8 +printf("Caché !\n");
  9 +}
0 \ No newline at end of file 10 \ No newline at end of file
code_mort.c.067t.dce1 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +
  2 +;; Function main (main, funcdef_no=11, decl_uid=2234, symbol_order=11) (executed once)
  3 +
  4 +main ()
  5 +{
  6 + <bb 2>:
  7 + __builtin_puts (&"Coucou !"[0]);
  8 + return 1;
  9 +
  10 +}
  11 +
  12 +
code_mort.c.083t.dce2 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +
  2 +;; Function main (main, funcdef_no=11, decl_uid=2234, symbol_order=11) (executed once)
  3 +
  4 +main ()
  5 +{
  6 + <bb 2>:
  7 + __builtin_puts (&"Coucou !"[0]);
  8 + return 1;
  9 +
  10 +}
  11 +
  12 +
deroulement_boucle 0 → 100755
No preview for this file type
deroulement_boucle.c 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +#include <stdio.h>
  2 +#define TAILLE 100
  3 +#define TAILLE1 500
  4 +#define TAILLE2 500
  5 +int a[TAILLE][TAILLE1][TAILLE2];
  6 +int main(void){
  7 +int resultat=0;
  8 +int i,e,u;
  9 +for(i=0;i<TAILLE;i++) { for(e=0; e < TAILLE1;e++) { for(u=0; u<TAILLE2;u++) { a[i][e][u]=rand(); }}}
  10 +for(i=0;i<TAILLE;i++) { for(e=0; e < TAILLE1;e++) { for(u=0; u<TAILLE2;u++) { resultat += a[i][e][u]; }}}
  11 +return resultat;
  12 +}
deroulement_boucle.c.117t.cunroll 0 → 100644
@@ -0,0 +1,153 @@ @@ -0,0 +1,153 @@
  1 +
  2 +;; Function main (main, funcdef_no=11, decl_uid=2235, symbol_order=12) (executed once)
  3 +
  4 +main ()
  5 +{
  6 + int vect_resultat_28.9;
  7 + vector(4) int vect_resultat_28.8;
  8 + int stmp_resultat_28.7;
  9 + vector(4) int vect_resultat_28.6;
  10 + vector(4) int vect__27.5;
  11 + vector(4) int * vectp_a.4;
  12 + vector(4) int * vectp_a.3;
  13 + int u;
  14 + int e;
  15 + int i;
  16 + int resultat;
  17 + unsigned int ivtmp_1;
  18 + unsigned int ivtmp_2;
  19 + unsigned int ivtmp_3;
  20 + unsigned int ivtmp_4;
  21 + unsigned int ivtmp_5;
  22 + unsigned int ivtmp_6;
  23 + unsigned int ivtmp_7;
  24 + unsigned int ivtmp_8;
  25 + unsigned int ivtmp_9;
  26 + int _19;
  27 + unsigned int ivtmp_25;
  28 + unsigned int ivtmp_32;
  29 + sizetype _40;
  30 + sizetype _42;
  31 + sizetype _44;
  32 + sizetype _45;
  33 + sizetype _47;
  34 + unsigned int ivtmp_59;
  35 +
  36 + <bb 2>:
  37 + goto <bb 11>;
  38 +
  39 + <bb 3>:
  40 +
  41 + <bb 4>:
  42 + # u_54 = PHI <u_21(3), 0(7)>
  43 + # ivtmp_9 = PHI <ivtmp_7(3), 500(7)>
  44 + _19 = rand ();
  45 + a[i_26][e_52][u_54] = _19;
  46 + u_21 = u_54 + 1;
  47 + ivtmp_7 = ivtmp_9 - 1;
  48 + if (ivtmp_7 != 0)
  49 + goto <bb 3>;
  50 + else
  51 + goto <bb 5>;
  52 +
  53 + <bb 5>:
  54 + e_22 = e_52 + 1;
  55 + ivtmp_3 = ivtmp_4 - 1;
  56 + if (ivtmp_3 != 0)
  57 + goto <bb 6>;
  58 + else
  59 + goto <bb 8>;
  60 +
  61 + <bb 6>:
  62 +
  63 + <bb 7>:
  64 + # e_52 = PHI <e_22(6), 0(11)>
  65 + # ivtmp_4 = PHI <ivtmp_3(6), 500(11)>
  66 + goto <bb 4>;
  67 +
  68 + <bb 8>:
  69 + i_23 = i_26 + 1;
  70 + ivtmp_1 = ivtmp_2 - 1;
  71 + if (ivtmp_1 != 0)
  72 + goto <bb 10>;
  73 + else
  74 + goto <bb 9>;
  75 +
  76 + <bb 9>:
  77 + goto <bb 19>;
  78 +
  79 + <bb 10>:
  80 +
  81 + <bb 11>:
  82 + # i_26 = PHI <i_23(10), 0(2)>
  83 + # ivtmp_2 = PHI <ivtmp_1(10), 100(2)>
  84 + goto <bb 7>;
  85 +
  86 + <bb 12>:
  87 +
  88 + <bb 13>:
  89 + # vectp_a.3_49 = PHI <vectp_a.3_50(12), vectp_a.4_39(16)>
  90 + # vect_resultat_28.6_46 = PHI <vect_resultat_28.6_12(12), { 0, 0, 0, 0 }(16)>
  91 + # ivtmp_25 = PHI <ivtmp_59(12), 0(16)>
  92 + vect__27.5_48 = MEM[(int *)vectp_a.3_49];
  93 + vect_resultat_28.6_12 = vect__27.5_48 + vect_resultat_28.6_46;
  94 + vectp_a.3_50 = vectp_a.3_49 + 16;
  95 + ivtmp_59 = ivtmp_25 + 1;
  96 + if (ivtmp_59 < 125)
  97 + goto <bb 12>;
  98 + else
  99 + goto <bb 14>;
  100 +
  101 + <bb 14>:
  102 + # vect_resultat_28.6_11 = PHI <vect_resultat_28.6_12(13)>
  103 + vect_resultat_28.8_10 = vect_resultat_28.6_11 v>> 64;
  104 + vect_resultat_28.8_17 = vect_resultat_28.8_10 + vect_resultat_28.6_11;
  105 + vect_resultat_28.8_14 = vect_resultat_28.8_17 v>> 32;
  106 + vect_resultat_28.8_24 = vect_resultat_28.8_14 + vect_resultat_28.8_17;
  107 + stmp_resultat_28.7_16 = BIT_FIELD_REF <vect_resultat_28.8_24, 32, 0>;
  108 + vect_resultat_28.9_33 = stmp_resultat_28.7_16 + resultat_34;
  109 + e_30 = e_53 + 1;
  110 + ivtmp_8 = ivtmp_32 - 1;
  111 + if (ivtmp_8 != 0)
  112 + goto <bb 15>;
  113 + else
  114 + goto <bb 17>;
  115 +
  116 + <bb 15>:
  117 +
  118 + <bb 16>:
  119 + # resultat_34 = PHI <vect_resultat_28.9_33(15), resultat_35(19)>
  120 + # e_53 = PHI <e_30(15), 0(19)>
  121 + # ivtmp_32 = PHI <ivtmp_8(15), 500(19)>
  122 + _44 = (sizetype) i_51;
  123 + _42 = _44 * 1000000;
  124 + _40 = (sizetype) e_53;
  125 + _47 = _40 * 2000;
  126 + _45 = _42 + _47;
  127 + vectp_a.4_39 = &a + _45;
  128 + goto <bb 13>;
  129 +
  130 + <bb 17>:
  131 + # resultat_41 = PHI <vect_resultat_28.9_33(14)>
  132 + i_31 = i_51 + 1;
  133 + ivtmp_5 = ivtmp_6 - 1;
  134 + if (ivtmp_5 != 0)
  135 + goto <bb 18>;
  136 + else
  137 + goto <bb 20>;
  138 +
  139 + <bb 18>:
  140 +
  141 + <bb 19>:
  142 + # resultat_35 = PHI <resultat_41(18), 0(9)>
  143 + # i_51 = PHI <i_31(18), 0(9)>
  144 + # ivtmp_6 = PHI <ivtmp_5(18), 100(9)>
  145 + goto <bb 16>;
  146 +
  147 + <bb 20>:
  148 + # resultat_37 = PHI <resultat_41(17)>
  149 + return resultat_37;
  150 +
  151 +}
  152 +
  153 +
deroulement_boucle.c.169t.optimized 0 → 100644
@@ -0,0 +1,126 @@ @@ -0,0 +1,126 @@
  1 +
  2 +;; Function main (main, funcdef_no=11, decl_uid=2235, symbol_order=12) (executed once)
  3 +
  4 +Removing basic block 14
  5 +Removing basic block 15
  6 +Removing basic block 16
  7 +Removing basic block 17
  8 +Removing basic block 18
  9 +Removing basic block 19
  10 +Removing basic block 20
  11 +Removing basic block 21
  12 +Removing basic block 22
  13 +Removing basic block 23
  14 +main ()
  15 +{
  16 + unsigned long ivtmp.58;
  17 + unsigned long ivtmp.49;
  18 + unsigned long ivtmp.41;
  19 + unsigned long ivtmp.32;
  20 + unsigned long ivtmp.23;
  21 + unsigned long ivtmp.12;
  22 + vector(4) int vect_resultat_28.8;
  23 + int stmp_resultat_28.7;
  24 + vector(4) int vect_resultat_28.6;
  25 + vector(4) int vect__27.5;
  26 + int resultat;
  27 + void * _13;
  28 + int _19;
  29 + void * _36;
  30 + unsigned long _39;
  31 + unsigned long _50;
  32 + unsigned long _62;
  33 + unsigned long _65;
  34 + unsigned long _74;
  35 +
  36 + <bb 2>:
  37 + ivtmp.58_6 = (unsigned long) &MEM[(void *)&a + 1000000B];
  38 + _62 = (unsigned long) &MEM[(void *)&a + 101000000B];
  39 + goto <bb 7>;
  40 +
  41 + <bb 3>:
  42 + # ivtmp.41_51 = PHI <ivtmp.41_60(3), ivtmp.49_54(5)>
  43 + _19 = rand ();
  44 + _36 = (void *) ivtmp.41_51;
  45 + MEM[base: _36, offset: 0B] = _19;
  46 + ivtmp.41_60 = ivtmp.41_51 + 4;
  47 + if (ivtmp.41_60 != _74)
  48 + goto <bb 3>;
  49 + else
  50 + goto <bb 4>;
  51 +
  52 + <bb 4>:
  53 + if (ivtmp.58_52 != _74)
  54 + goto <bb 5>;
  55 + else
  56 + goto <bb 6>;
  57 +
  58 + <bb 5>:
  59 + # ivtmp.49_54 = PHI <_74(4), _50(7)>
  60 + _74 = ivtmp.49_54 + 2000;
  61 + goto <bb 3>;
  62 +
  63 + <bb 6>:
  64 + ivtmp.58_31 = ivtmp.58_52 + 1000000;
  65 + if (ivtmp.58_31 != _62)
  66 + goto <bb 7>;
  67 + else
  68 + goto <bb 12>;
  69 +
  70 + <bb 7>:
  71 + # ivtmp.58_52 = PHI <ivtmp.58_31(6), ivtmp.58_6(2)>
  72 + _50 = ivtmp.58_52 + 18446744073708551616;
  73 + goto <bb 5>;
  74 +
  75 + <bb 8>:
  76 + # vect_resultat_28.6_46 = PHI <vect_resultat_28.6_12(8), { 0, 0, 0, 0 }(10)>
  77 + # ivtmp.12_43 = PHI <ivtmp.12_38(8), ivtmp.23_49(10)>
  78 + _13 = (void *) ivtmp.12_43;
  79 + vect__27.5_48 = MEM[base: _13, offset: 0B];
  80 + vect_resultat_28.6_12 = vect__27.5_48 + vect_resultat_28.6_46;
  81 + ivtmp.12_38 = ivtmp.12_43 + 16;
  82 + if (ivtmp.12_38 != _65)
  83 + goto <bb 8>;
  84 + else
  85 + goto <bb 9>;
  86 +
  87 + <bb 9>:
  88 + # vect_resultat_28.6_11 = PHI <vect_resultat_28.6_12(8)>
  89 + vect_resultat_28.8_10 = vect_resultat_28.6_11 v>> 64;
  90 + vect_resultat_28.8_17 = vect_resultat_28.8_10 + vect_resultat_28.6_11;
  91 + vect_resultat_28.8_14 = vect_resultat_28.8_17 v>> 32;
  92 + vect_resultat_28.8_24 = vect_resultat_28.8_14 + vect_resultat_28.8_17;
  93 + stmp_resultat_28.7_16 = BIT_FIELD_REF <vect_resultat_28.8_24, 32, 0>;
  94 + resultat_33 = stmp_resultat_28.7_16 + resultat_34;
  95 + if (ivtmp.32_53 != _65)
  96 + goto <bb 10>;
  97 + else
  98 + goto <bb 11>;
  99 +
  100 + <bb 10>:
  101 + # resultat_34 = PHI <resultat_33(9), resultat_35(12)>
  102 + # ivtmp.23_49 = PHI <_65(9), _39(12)>
  103 + _65 = ivtmp.23_49 + 2000;
  104 + goto <bb 8>;
  105 +
  106 + <bb 11>:
  107 + # resultat_41 = PHI <resultat_33(9)>
  108 + ivtmp.32_40 = ivtmp.32_53 + 1000000;
  109 + if (ivtmp.32_40 != _62)
  110 + goto <bb 12>;
  111 + else
  112 + goto <bb 13>;
  113 +
  114 + <bb 12>:
  115 + # resultat_35 = PHI <resultat_41(11), 0(6)>
  116 + # ivtmp.32_53 = PHI <ivtmp.32_40(11), ivtmp.58_6(6)>
  117 + _39 = ivtmp.32_53 + 18446744073708551616;
  118 + goto <bb 10>;
  119 +
  120 + <bb 13>:
  121 + # resultat_37 = PHI <resultat_41(11)>
  122 + return resultat_37;
  123 +
  124 +}
  125 +
  126 +
loptimizz 0 → 100644
@@ -0,0 +1,139 @@ @@ -0,0 +1,139 @@
  1 +/////////////////////////////////////////// Optimisation 2/5 ////////////////////////////////////////////////////
  2 +
  3 +exercices : "fonctions imbriquées"
  4 +
  5 +Le compilateur voit bien l'utilité de la fonction "oppose" et remplace directement par des "-" .
  6 +
  7 +
  8 +
  9 +
  10 +
  11 +
  12 +
  13 +
  14 +exercices "calcul du gain"
  15 +
  16 +On ajoute deux dimensions au tableau ( a[1000][1000][1000] )
  17 +
  18 +et on voit bien la différence
  19 +
  20 +avec optimisation :
  21 +real 0m7.410s
  22 +user 0m6.728s
  23 +sys 0m0.672s
  24 + il est environ 1.5 fois plus rapide
  25 +
  26 +sans optimisation :
  27 +real 0m10.000s
  28 +user 0m9.364s
  29 +sys 0m0.624s
  30 +
  31 +
  32 +
  33 +avec a[100][500][500]
  34 +
  35 +optimisé :
  36 +real 0m0.245s
  37 +user 0m0.216s
  38 +sys 0m0.028s
  39 + il est presque deux fois plus rapide avec la version optimisée
  40 +
  41 +non optimisé :
  42 +real 0m0.405s
  43 +user 0m0.384s
  44 +sys 0m0.020s
  45 +
  46 +
  47 +exercices "multiplication récursive"
  48 +
  49 +plus aboutie car le compilateur remplace directement les additions par une multiplication
  50 +
  51 +
  52 +/////////////////////////////////////////// Optimisation 3/5 ////////////////////////////////////////////////////
  53 +
  54 +
  55 +Exercice de code mort
  56 +
  57 +je modifie legerement le programme
  58 +
  59 +#include <stdio.h>
  60 +int main(void){
  61 +int a=0;
  62 +if(a==2) printf("Bonjour \n");
  63 +printf("Coucou !\n");
  64 +a=1;
  65 +return a;
  66 +printf("Caché !\n");
  67 +}
  68 +
  69 +et le compile
  70 +résultat :
  71 +
  72 +;; Function main (main, funcdef_no=11, decl_uid=2234, symbol_order=11) (executed once)
  73 +
  74 +main ()
  75 +{
  76 + <bb 2>:
  77 + __builtin_puts (&"Coucou !"[0]);
  78 + return 1;
  79 +
  80 +}
  81 +
  82 +Le compilateur enlève la ligne if(a==2) printf("Bonjour \n"); qui ne s'executerait jamais --> Code mort
  83 +
  84 +
  85 +Exercice de propagation :
  86 +
  87 +en modifiant le code de cette manière puis en compilant (avec -03) j'obtient :
  88 +
  89 + int main(void){
  90 +int a=1,b=2,c=3, i=2;
  91 +int d=a*c,e=d+2*b;
  92 +while(i > 0) { i--; if(e!=2) e--; }
  93 +return e;
  94 +}
  95 +
  96 +
  97 +;; Function main (main, funcdef_no=0, decl_uid=1743, symbol_order=0) (executed once)
  98 +
  99 +main ()
  100 +{
  101 + int e;
  102 + int i;
  103 +
  104 + <bb 2>:
  105 + return 5;
  106 +
  107 +}
  108 +
  109 +C'est assez impressionant !
  110 +
  111 +Exercice second degre :
  112 +
  113 +#include <stdio.h>
  114 +#include <math.h>
  115 +
  116 +int main() {
  117 + int a,b,c;
  118 + scanf("%d,%d,%d",&a,&b,&c);
  119 + float r1, r2;
  120 +
  121 +if(b*b-4*a*c > 0) { r1=(-b-sqrt(b*b-4*a*c))/(2*a); r2=(-b+sqrt(b*b-4*a*c))/(2*a); printf("r1 = %f \nr2 = %f",r1,r2);}
  122 +
  123 +if(b*b-4*a*c == 0) { r1 = -b/(2*a); r2=r1; printf("r1 = %f \nr2 = %f",r1,r2); }
  124 +
  125 +if(b*b-4*a*c < 0) printf("pas de racine");
  126 +
  127 +return 0;
  128 +
  129 +}
  130 +
  131 +
  132 + Pour ce code le compilateur recalcule le delta au moins une fois
  133 +
  134 +
  135 +
  136 +
  137 +
  138 +
  139 +
optimisation2 0 → 100755
No preview for this file type
optimisation2.c 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +#include <stdio.h>
  2 +static int oppose(int y) {return y*(-1);}
  3 +static int soustraction(int x,int y){ return x+ oppose(y); }
  4 +int main(void){
  5 +int a,b,c;
  6 +printf("Donnez 3 entiers\n");
  7 +scanf("%d %d %d",&a,&b,&c);
  8 +printf("%d\n",soustraction(a,soustraction(b,c)));
  9 +return 0;
  10 +}
optimisation2.c.018t.einline 0 → 100644
@@ -0,0 +1,110 @@ @@ -0,0 +1,110 @@
  1 +
  2 +;; Function oppose (oppose, funcdef_no=11, decl_uid=2234, symbol_order=11)
  3 +
  4 +Iterations: 0
  5 +oppose (int y)
  6 +{
  7 + int _2;
  8 +
  9 + <bb 2>:
  10 + _2 = -y_1(D);
  11 + return _2;
  12 +
  13 +}
  14 +
  15 +
  16 +
  17 +;; Function soustraction (soustraction, funcdef_no=12, decl_uid=2238, symbol_order=12)
  18 +
  19 +Considering inline candidate oppose.
  20 + Inlining oppose into soustraction.
  21 +Iterations: 1
  22 +Merging blocks 2 and 4
  23 +Merging blocks 2 and 3
  24 +
  25 +Symbols to be put in SSA form
  26 +{ D.2264 }
  27 +Incremental SSA update started at block: 0
  28 +Number of blocks in CFG: 3
  29 +Number of blocks to update: 2 ( 67%)
  30 +
  31 +
  32 +soustraction (int x, int y)
  33 +{
  34 + int D.2264;
  35 + int _2;
  36 + int _4;
  37 + int _6;
  38 +
  39 + <bb 2>:
  40 + _6 = -y_1(D);
  41 + _7 = _6;
  42 + _2 = _7;
  43 + _4 = _2 + x_3(D);
  44 + return _4;
  45 +
  46 +}
  47 +
  48 +
  49 +
  50 +;; Function main (main, funcdef_no=13, decl_uid=2241, symbol_order=13)
  51 +
  52 +Considering inline candidate soustraction.
  53 + Inlining soustraction into main.
  54 +Considering inline candidate soustraction.
  55 + Inlining soustraction into main.
  56 +Iterations: 1
  57 +Merging blocks 2 and 4
  58 +Merging blocks 3 and 6
  59 +Merging blocks 2 and 3
  60 +Merging blocks 2 and 5
  61 +
  62 +Symbols to be put in SSA form
  63 +{ D.2269 D.2272 }
  64 +Incremental SSA update started at block: 0
  65 +Number of blocks in CFG: 3
  66 +Number of blocks to update: 2 ( 67%)
  67 +
  68 +
  69 +main ()
  70 +{
  71 + int D.2272;
  72 + int D.2269;
  73 + int c;
  74 + int b;
  75 + int a;
  76 + int c.0_4;
  77 + int b.1_5;
  78 + int _6;
  79 + int a.2_7;
  80 + int _8;
  81 + int _10;
  82 + int _14;
  83 + int _15;
  84 + int _16;
  85 + int _17;
  86 +
  87 + <bb 2>:
  88 + __builtin_puts (&"Donnez 3 entiers"[0]);
  89 + scanf ("%d %d %d", &a, &b, &c);
  90 + c.0_4 = c;
  91 + b.1_5 = b;
  92 + _14 = -c.0_4;
  93 + _15 = b.1_5 + _14;
  94 + _18 = _15;
  95 + _6 = _18;
  96 + a.2_7 = a;
  97 + _16 = -_6;
  98 + _17 = a.2_7 + _16;
  99 + _19 = _17;
  100 + _8 = _19;
  101 + printf ("%d\n", _8);
  102 + _10 = 0;
  103 + a ={v} {CLOBBER};
  104 + b ={v} {CLOBBER};
  105 + c ={v} {CLOBBER};
  106 + return _10;
  107 +
  108 +}
  109 +
  110 +
optimisation2.c.169t.optimized 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +
  2 +;; Function main (main, funcdef_no=13, decl_uid=2241, symbol_order=13) (executed once)
  3 +
  4 +main ()
  5 +{
  6 + int c;
  7 + int b;
  8 + int a;
  9 + int c.0_4;
  10 + int b.1_5;
  11 + int a.2_6;
  12 + int _11;
  13 + int _12;
  14 +
  15 + <bb 2>:
  16 + __builtin_puts (&"Donnez 3 entiers"[0]);
  17 + scanf ("%d %d %d", &a, &b, &c);
  18 + c.0_4 = c;
  19 + b.1_5 = b;
  20 + _11 = b.1_5 - c.0_4;
  21 + a.2_6 = a;
  22 + _12 = a.2_6 - _11;
  23 + printf ("%d\n", _12);
  24 + a ={v} {CLOBBER};
  25 + b ={v} {CLOBBER};
  26 + c ={v} {CLOBBER};
  27 + return 0;
  28 +
  29 +}
  30 +
  31 +
propagation 0 → 100755
No preview for this file type
propagation.c 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 + int main(void){
  2 +int a=1,b=2,c=3, i=2;
  3 +int d=a*c,e=d+2*b;
  4 +while(i > 0) { i--; if(e!=2) e--; }
  5 +return e;
  6 +}
propagation.c.021t.ccp1 0 → 100644
@@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
  1 +
  2 +;; Function main (main, funcdef_no=0, decl_uid=1743, symbol_order=0)
  3 +
  4 +main ()
  5 +{
  6 + int e;
  7 + int d;
  8 + int i;
  9 + int c;
  10 + int b;
  11 + int a;
  12 +
  13 + <bb 2>:
  14 + i_6 = 2;
  15 + e_9 = 7;
  16 + goto <bb 5>;
  17 +
  18 + <bb 3>:
  19 + i_10 = i_1 + -1;
  20 + if (e_2 != 2)
  21 + goto <bb 4>;
  22 + else
  23 + goto <bb 5>;
  24 +
  25 + <bb 4>:
  26 + e_11 = e_2 + -1;
  27 +
  28 + <bb 5>:
  29 + # i_1 = PHI <2(2), i_10(3), i_10(4)>
  30 + # e_2 = PHI <7(2), e_2(3), e_11(4)>
  31 + if (i_1 > 0)
  32 + goto <bb 3>;
  33 + else
  34 + goto <bb 6>;
  35 +
  36 + <bb 6>:
  37 + e_12 = e_2;
  38 + return e_12;
  39 +
  40 +}
  41 +
  42 +
propagation.c.055t.ccp2 0 → 100644
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
  1 +
  2 +;; Function main (main, funcdef_no=0, decl_uid=1743, symbol_order=0) (executed once)
  3 +
  4 +main ()
  5 +{
  6 + int e;
  7 + int i;
  8 +
  9 + <bb 2>:
  10 + goto <bb 7>;
  11 +
  12 + <bb 3>:
  13 + i_5 = i_1 + -1;
  14 + if (e_2 != 2)
  15 + goto <bb 4>;
  16 + else
  17 + goto <bb 5>;
  18 +
  19 + <bb 4>:
  20 + e_6 = e_2 + -1;
  21 +
  22 + <bb 5>:
  23 + # i_3 = PHI <i_5(4), i_5(3)>
  24 + # e_4 = PHI <e_6(4), e_2(3)>
  25 +
  26 + <bb 7>:
  27 + # i_1 = PHI <i_3(5), 2(2)>
  28 + # e_2 = PHI <e_4(5), 7(2)>
  29 + if (i_1 > 0)
  30 + goto <bb 3>;
  31 + else
  32 + goto <bb 6>;
  33 +
  34 + <bb 6>:
  35 + e_7 = e_2;
  36 + return e_7;
  37 +
  38 +}
  39 +
  40 +
propagation.c.087t.ccp3 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +
  2 +;; Function main (main, funcdef_no=0, decl_uid=1743, symbol_order=0) (executed once)
  3 +
  4 +main ()
  5 +{
  6 + int e;
  7 + int i;
  8 +
  9 + <bb 2>:
  10 + return 5;
  11 +
  12 +}
  13 +
  14 +
recursion 0 → 100755
No preview for this file type
recursion.c 0 → 100644
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +#include <stdio.h>
  2 +int multiplication(int a,int b){
  3 +if(b==0) return 0;
  4 +else return multiplication(a,b-1)+a;
  5 +}
  6 +int main(void){
  7 +int a,b;
  8 +scanf("%d %d",&a,&b);
  9 +printf("%d\n",multiplication(a,b));
  10 +return 0;
  11 +}
recursion.c.169t.optimized 0 → 100644
@@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
  1 +
  2 +;; Function multiplication (multiplication, funcdef_no=11, decl_uid=2235, symbol_order=11)
  3 +
  4 +Removing basic block 5
  5 +multiplication (int a, int b)
  6 +{
  7 + int add_acc_7;
  8 + int add_acc_9;
  9 +
  10 + <bb 2>:
  11 + if (b_11(D) == 0)
  12 + goto <bb 4>;
  13 + else
  14 + goto <bb 3>;
  15 +
  16 + <bb 3>:
  17 + add_acc_9 = a_4(D) * b_11(D);
  18 +
  19 + <bb 4>:
  20 + # add_acc_7 = PHI <add_acc_9(3), 0(2)>
  21 + return add_acc_7;
  22 +
  23 +}
  24 +
  25 +
  26 +
  27 +;; Function main (main, funcdef_no=12, decl_uid=2238, symbol_order=12) (executed once)
  28 +
  29 +Removing basic block 5
  30 +main ()
  31 +{
  32 + int a;
  33 + int b;
  34 + int b;
  35 + int a;
  36 + int add_acc_12;
  37 + int add_acc_13;
  38 +
  39 + <bb 2>:
  40 + scanf ("%d %d", &a, &b);
  41 + b_3 = b;
  42 + a_4 = a;
  43 + if (b_3 == 0)
  44 + goto <bb 4>;
  45 + else
  46 + goto <bb 3>;
  47 +
  48 + <bb 3>:
  49 + add_acc_12 = b_3 * a_4;
  50 +
  51 + <bb 4>:
  52 + # add_acc_13 = PHI <add_acc_12(3), 0(2)>
  53 + printf ("%d\n", add_acc_13);
  54 + a ={v} {CLOBBER};
  55 + b ={v} {CLOBBER};
  56 + return 0;
  57 +
  58 +}
  59 +
  60 +
second_degre 0 → 100755
No preview for this file type
second_degre.c 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +#include <stdio.h>
  2 +#include <math.h>
  3 +
  4 +int main() {
  5 + int a,b,c;
  6 + scanf("%d,%d,%d",&a,&b,&c);
  7 + float r1, r2;
  8 +
  9 +if(b*b-4*a*c > 0) { r1=(-b-sqrt(b*b-4*a*c))/(2*a); r2=(-b+sqrt(b*b-4*a*c))/(2*a); printf("r1 = %f \nr2 = %f",r1,r2);}
  10 +
  11 +if(b*b-4*a*c == 0) { r1 = -b/(2*a); r2=r1; printf("r1 = %f \nr2 = %f",r1,r2); }
  12 +
  13 +if(b*b-4*a*c < 0) printf("pas de racine");
  14 +
  15 +return 0;
  16 +
  17 +}
  18 +
  19 +
  20 +
second_degre.c.120t.ivopts 0 → 100644
@@ -0,0 +1,153 @@ @@ -0,0 +1,153 @@
  1 +
  2 +;; Function main (main, funcdef_no=14, decl_uid=3287, symbol_order=14) (executed once)
  3 +
  4 +main ()
  5 +{
  6 + float r2;
  7 + float r1;
  8 + int c;
  9 + int b;
  10 + int a;
  11 + int b.0_6;
  12 + int _7;
  13 + int a.1_8;
  14 + int _9;
  15 + int c.2_10;
  16 + int _11;
  17 + int _12;
  18 + int _13;
  19 + double _14;
  20 + double _15;
  21 + double _17;
  22 + double _18;
  23 + int a.1_19;
  24 + int _20;
  25 + double _21;
  26 + double _22;
  27 + int b.0_24;
  28 + int _25;
  29 + double _26;
  30 + int _27;
  31 + int _28;
  32 + int c.2_29;
  33 + int _30;
  34 + int _31;
  35 + double _32;
  36 + double _34;
  37 + double _35;
  38 + int a.1_36;
  39 + int _37;
  40 + double _38;
  41 + double _39;
  42 + double _41;
  43 + double _42;
  44 + int b.0_44;
  45 + int _45;
  46 + int a.1_46;
  47 + int _47;
  48 + int c.2_48;
  49 + int _49;
  50 + int _50;
  51 + int _51;
  52 + int _52;
  53 + double _54;
  54 + int pretmp_82;
  55 + int pretmp_84;
  56 + int pretmp_86;
  57 + int pretmp_88;
  58 + int pretmp_90;
  59 + int pretmp_92;
  60 + int pretmp_94;
  61 + int prephitmp_95;
  62 +
  63 + <bb 2>:
  64 + scanf ("%d,%d,%d", &a, &b, &c);
  65 + b.0_6 = b;
  66 + _7 = b.0_6 * b.0_6;
  67 + a.1_8 = a;
  68 + _9 = a.1_8 * -4;
  69 + c.2_10 = c;
  70 + _11 = _9 * c.2_10;
  71 + _12 = _7 + _11;
  72 + if (_12 > 0)
  73 + goto <bb 3>;
  74 + else
  75 + goto <bb 4>;
  76 +
  77 + <bb 3>:
  78 + _13 = -b.0_6;
  79 + _14 = (double) _13;
  80 + _15 = (double) _12;
  81 + _17 = sqrt (_15);
  82 + _18 = _14 - _17;
  83 + a.1_19 = a;
  84 + _20 = a.1_19 * 2;
  85 + _21 = (double) _20;
  86 + _22 = _18 / _21;
  87 + r1_23 = (float) _22;
  88 + b.0_24 = b;
  89 + _25 = -b.0_24;
  90 + _26 = (double) _25;
  91 + _27 = b.0_24 * b.0_24;
  92 + _28 = a.1_19 * -4;
  93 + c.2_29 = c;
  94 + _30 = _28 * c.2_29;
  95 + _31 = _27 + _30;
  96 + _32 = (double) _31;
  97 + _34 = sqrt (_32);
  98 + _35 = _26 + _34;
  99 + a.1_36 = a;
  100 + _37 = a.1_36 * 2;
  101 + _38 = (double) _37;
  102 + _39 = _35 / _38;
  103 + r2_40 = (float) _39;
  104 + _41 = (double) r2_40;
  105 + _42 = (double) r1_23;
  106 + printf ("r1 = %f \nr2 = %f", _42, _41);
  107 +
  108 + <bb 4>:
  109 + b.0_44 = b;
  110 + _45 = b.0_44 * b.0_44;
  111 + a.1_46 = a;
  112 + _47 = a.1_46 * -4;
  113 + c.2_48 = c;
  114 + _49 = _47 * c.2_48;
  115 + _50 = _45 + _49;
  116 + if (_50 == 0)
  117 + goto <bb 5>;
  118 + else
  119 + goto <bb 6>;
  120 +
  121 + <bb 5>:
  122 + _51 = a.1_46 * -2;
  123 + _52 = b.0_44 / _51;
  124 + r2_53 = (float) _52;
  125 + _54 = (double) r2_53;
  126 + printf ("r1 = %f \nr2 = %f", _54, _54);
  127 + pretmp_82 = b;
  128 + pretmp_84 = pretmp_82 * pretmp_82;
  129 + pretmp_86 = a;
  130 + pretmp_88 = pretmp_86 * -4;
  131 + pretmp_90 = c;
  132 + pretmp_92 = pretmp_88 * pretmp_90;
  133 + pretmp_94 = pretmp_84 + pretmp_92;
  134 +
  135 + <bb 6>:
  136 + # prephitmp_95 = PHI <_50(4), pretmp_94(5)>
  137 + if (prephitmp_95 < 0)
  138 + goto <bb 7>;
  139 + else
  140 + goto <bb 8>;
  141 +
  142 + <bb 7>:
  143 + printf ("pas de racine");
  144 +
  145 + <bb 8>:
  146 + a ={v} {CLOBBER};
  147 + b ={v} {CLOBBER};
  148 + c ={v} {CLOBBER};
  149 + return 0;
  150 +
  151 +}
  152 +
  153 +
second_degre.c.169t.optimized 0 → 100644
@@ -0,0 +1,156 @@ @@ -0,0 +1,156 @@
  1 +
  2 +;; Function main (main, funcdef_no=14, decl_uid=3287, symbol_order=14) (executed once)
  3 +
  4 +Removing basic block 9
  5 +Removing basic block 10
  6 +Removing basic block 11
  7 +main ()
  8 +{
  9 + float r2;
  10 + float r1;
  11 + int c;
  12 + int b;
  13 + int a;
  14 + int b.0_6;
  15 + int _7;
  16 + int a.1_8;
  17 + int _9;
  18 + int c.2_10;
  19 + int _11;
  20 + int _12;
  21 + int _13;
  22 + double _14;
  23 + double _15;
  24 + double _17;
  25 + double _18;
  26 + int a.1_19;
  27 + int _20;
  28 + double _21;
  29 + double _22;
  30 + int b.0_24;
  31 + int _25;
  32 + double _26;
  33 + int _27;
  34 + int _28;
  35 + int c.2_29;
  36 + int _30;
  37 + int _31;
  38 + double _32;
  39 + double _34;
  40 + double _35;
  41 + int a.1_36;
  42 + int _37;
  43 + double _38;
  44 + double _39;
  45 + double _41;
  46 + double _42;
  47 + int b.0_44;
  48 + int _45;
  49 + int a.1_46;
  50 + int _47;
  51 + int c.2_48;
  52 + int _49;
  53 + int _50;
  54 + int _51;
  55 + int _52;
  56 + double _54;
  57 + int pretmp_82;
  58 + int pretmp_84;
  59 + int pretmp_86;
  60 + int pretmp_88;
  61 + int pretmp_90;
  62 + int pretmp_92;
  63 + int pretmp_94;
  64 + int prephitmp_95;
  65 +
  66 + <bb 2>:
  67 + scanf ("%d,%d,%d", &a, &b, &c);
  68 + b.0_6 = b;
  69 + _7 = b.0_6 * b.0_6;
  70 + a.1_8 = a;
  71 + _9 = a.1_8 * -4;
  72 + c.2_10 = c;
  73 + _11 = _9 * c.2_10;
  74 + _12 = _7 + _11;
  75 + if (_12 > 0)
  76 + goto <bb 3>;
  77 + else
  78 + goto <bb 4>;
  79 +
  80 + <bb 3>:
  81 + _13 = -b.0_6;
  82 + _14 = (double) _13;
  83 + _15 = (double) _12;
  84 + _17 = sqrt (_15);
  85 + _18 = _14 - _17;
  86 + a.1_19 = a;
  87 + _20 = a.1_19 * 2;
  88 + _21 = (double) _20;
  89 + _22 = _18 / _21;
  90 + r1_23 = (float) _22;
  91 + b.0_24 = b;
  92 + _25 = -b.0_24;
  93 + _26 = (double) _25;
  94 + _27 = b.0_24 * b.0_24;
  95 + _28 = a.1_19 * -4;
  96 + c.2_29 = c;
  97 + _30 = _28 * c.2_29;
  98 + _31 = _27 + _30;
  99 + _32 = (double) _31;
  100 + _34 = sqrt (_32);
  101 + _35 = _26 + _34;
  102 + a.1_36 = a;
  103 + _37 = a.1_36 * 2;
  104 + _38 = (double) _37;
  105 + _39 = _35 / _38;
  106 + r2_40 = (float) _39;
  107 + _41 = (double) r2_40;
  108 + _42 = (double) r1_23;
  109 + printf ("r1 = %f \nr2 = %f", _42, _41);
  110 +
  111 + <bb 4>:
  112 + b.0_44 = b;
  113 + _45 = b.0_44 * b.0_44;
  114 + a.1_46 = a;
  115 + _47 = a.1_46 * -4;
  116 + c.2_48 = c;
  117 + _49 = _47 * c.2_48;
  118 + _50 = _45 + _49;
  119 + if (_50 == 0)
  120 + goto <bb 5>;
  121 + else
  122 + goto <bb 6>;
  123 +
  124 + <bb 5>:
  125 + _51 = a.1_46 * -2;
  126 + _52 = b.0_44 / _51;
  127 + r2_53 = (float) _52;
  128 + _54 = (double) r2_53;
  129 + printf ("r1 = %f \nr2 = %f", _54, _54);
  130 + pretmp_82 = b;
  131 + pretmp_84 = pretmp_82 * pretmp_82;
  132 + pretmp_86 = a;
  133 + pretmp_88 = pretmp_86 * -4;
  134 + pretmp_90 = c;
  135 + pretmp_92 = pretmp_88 * pretmp_90;
  136 + pretmp_94 = pretmp_84 + pretmp_92;
  137 +
  138 + <bb 6>:
  139 + # prephitmp_95 = PHI <_50(4), pretmp_94(5)>
  140 + if (prephitmp_95 < 0)
  141 + goto <bb 7>;
  142 + else
  143 + goto <bb 8>;
  144 +
  145 + <bb 7>:
  146 + printf ("pas de racine");
  147 +
  148 + <bb 8>:
  149 + a ={v} {CLOBBER};
  150 + b ={v} {CLOBBER};
  151 + c ={v} {CLOBBER};
  152 + return 0;
  153 +
  154 +}
  155 +
  156 +