In this thesis, we introduce Rec2Poly, a framework for speculative rewriting of recursiveprograms as affine loops that are candidates for efficient optimization and paralleliza-tion. Rec2Poly seeks a polyhedral-compliant run-time control and memory behavior inrecursions making use of an offline profiling technique. When it succeeds to model thebehavior of a recursive program as affine loops, it can use the affine loop model to automatically generate an optimized and parallelized code based on the inspector-executorstrategy for the next executions of the program. The inspector involves a light version ofthe original recursive program whose role is to collect, generate and verify run-time in-formation that is crucial to ensure the correctness...