[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-151941-en":3,"doc-seo-151941-105":30,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":4,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":27,"seo_description":14,"update_tm":28,"read_time":29},151941,34359740700684,"Finn","https://ap-avatar.wpscdn.com/avatar/1f400023980c374ae676?_k=1777273430885731487",8,"Research & Report","Loop Rolling for Code Size Reduction - RoLAG code-size optimization","Code size is critical for resource-constrained devices where memory and storage are limited, motivating compiler optimizations that directly reduce instruction footprint. Existing loop rerolling techniques mainly convert partially unrolled loops into fully rolled loops and fail to handle partial rerolling or straight-line code, limiting real-world applicability. This paper presents RoLAG, which forms loops from straight-line code by aligning isomorphic SSA graphs bottom-up, then rolling aligned code into loops. It adds pattern-based alignment expansion and a profitability analysis to decide which rolled versions to keep, achieving large absolute reductions up to 88 KB on benchmark suites and meaningful savings on GitHub-derived real code.","Loop Rolling for Code Size Reduction  \nRodrigo C. O. Rocha Pavlos Petoumenos  \nUniversity of Edinburgh, UK University of Manchester, UK  \n[rrocha@ed.ac.uk](rrocha@ed.ac.uk) [pavlos.petoumenos@manchester.ac.uk](pavlos.petoumenos@manchester.ac.uk)  \nBj¨orn Franke Pramod Bhatotia Michael O’Boyle  \nUniversity of Edinburgh, UK Technical University of Munich, Germany University of Edinburgh, UK [bfranke@inf.ed.ac.uk](bfranke@inf.ed.ac.uk) [pramod.bhatotia@in.tum.de](pramod.bhatotia@in.tum.de) [mob@inf.ed.ac.uk](mob@inf.ed.ac.uk)  \nAbstract—Code size is critical for resource-constrained devices, where memory and storage are limited. Compilers, therefore, should offer optimizations aimed at code reduction. One such optimization is loop rerolling, which transforms a partially unrolled loop into a fully rolled one. However, existing techniques are limited and rarely applicable to real-world programs. They are incapable of handling partial rerolling or straight-line code.  \nIn this paper, we propose RoLAG, a novel code-size optimization that creates loops out of straight-line code. It identi􀀂es isomorphic code by aligning SSA graphs in a bottom-up fashion. The aligned code is later rolled into a loop. In addition, we propose several optimizations that increase the amount of aligned code by identifying speci􀀂c patterns of code. Finally, an analysis is used to estimate the pro􀀂tability of the rolled loop before deciding which version should be kept in the code.  \nOur evaluation of RoLAG on full programs from MiBench and SPEC 2017 show absolute reductions of up to 88 KB while LLVM’s technique is hardly distinguishable from the baseline with no rerolling. Finally, our results show that RoLAG is highly applicable to real-world code extracted from popular GitHub repositories. RoLAG is triggered several orders of magnitude more often than LLVM’s rerolling, resulting in meaningful reductions on real-world functions.  \nIndex Terms—Code-Size Reduction, Loop Optimization, Loop Rerolling, LLVM, Compiler Optimization  \nI. INTRODUCTION  \nCode size is critical for programs targeting resourceconstrained systems. Within embedded systems, the memory occupied by code is a signi􀀂cant issue. Small differences translate directly to increases in cost, leading to lost pro􀀂tat large scales [1], [2] . The size of mobile applications is important not only for the end-user experience but also for vendors as download size can greatly impact their revenues [3] . In such scenarios, reducing the program footprint is a priority.  \nCompilers currently provide speci􀀂c optimizations tailored for code size reduction [2], [4], [5] . These include common sub-expression elimination [6], partial redundancy elimination [7], constant propagation [8], dead and unreachable code elimination [9] . Modern size optimizations have been more ambitious, focusing on merging equivalent code to avoid duplicates. Function merging identi􀀂es functions with suf􀀂cient similarity and merges them into a single function [2], [10]–[12] . Function outlining is another such optimization that works at the block level. It identi􀀂es equivalent basic blocks across all the functions and extracts them into a function, replacing all the copies by a function call [3] .  \nOnce we have all similar code merged, is there anything else we can do to compress code size? One promising approach is loop (re)rolling which works at the instruction level. It works by transforming equivalent instructions from a single block into a loop. However, existing loop rerolling is limited to transforming partially unrolled loops into fully rolled loops. It is incapable of rolling straight-line code into loops. This highly restrictive approach is rarely applicable to real-world code. Our insight is that the weak results of the existing loop rerolling implementations are not due to the lack of duplicate code but due to the rigid and overly restrictive algorithms they use to 􀀂nd code duplicates.  \nIn this paper, we propose RoLAG, a nov","cbCaiiVMR3pEvLQi","https://ap.wps.com/l/cbCaiiVMR3pEvLQi","pdf",754469,1,13,"English","en",105,"# Abstract\n## Introduction\n## Related Code-Size Optimizations\n## RoLAG Approach for Straight-Line Code\n## Evaluation and Results","[{\"question\":\"What limitation do existing loop rerolling techniques have for real-world programs?\",\"answer\":\"They mainly support transforming partially unrolled loops into fully rolled loops, and they cannot roll straight-line code or handle partial rerolling, which makes them rarely applicable in practice.\"},{\"question\":\"How does RoLAG create loops from straight-line code?\",\"answer\":\"RoLAG identifies isomorphic code by aligning SSA graphs in a bottom-up manner, expands alignment using specific code patterns, and rolls the aligned pieces into loop form.\"},{\"question\":\"How do the authors decide which rolled-loop version to keep?\",\"answer\":\"They use a profitability analysis to estimate the benefit of the rolled loop before selecting the version that should remain in the code.\"}]","Loop Rolling for Code Size Reduction - RoLAG code-size optimization | PDF",1787853234,33,{"code":4,"msg":31,"data":32},"ok",{"site_id":24,"language":23,"slug":33,"title":13,"keywords":34,"description":14,"schema_data":35,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":28},"loop-rolling-for-code-size-reduction-rolag-code-size-optimization","",{"@graph":36,"@context":85},[37,54,68],{"@type":38,"itemListElement":39},"BreadcrumbList",[40,44,48,51],{"item":41,"name":42,"@type":43,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":45,"name":46,"@type":43,"position":47},"https://docshare.wps.com/document/","Document",2,{"item":49,"name":12,"@type":43,"position":50},"https://docshare.wps.com/document/research-report/",3,{"item":52,"name":13,"@type":43,"position":53},"https://docshare.wps.com/document/loop-rolling-for-code-size-reduction-rolag-code-size-optimization/151941/",4,{"url":52,"name":13,"@type":55,"author":56,"headline":13,"publisher":58,"fileFormat":61,"inLanguage":23,"description":14,"dateModified":62,"datePublished":62,"encodingFormat":61,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":57},"Person",{"url":41,"name":59,"@type":60},"DocShare","Organization","application/pdf","2026-08-27",true,{"@type":65,"interactionType":66,"userInteractionCount":4},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"What limitation do existing loop rerolling techniques have for real-world programs?","Question",{"text":75,"@type":76},"They mainly support transforming partially unrolled loops into fully rolled loops, and they cannot roll straight-line code or handle partial rerolling, which makes them rarely applicable in practice.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"How does RoLAG create loops from straight-line code?",{"text":80,"@type":76},"RoLAG identifies isomorphic code by aligning SSA graphs in a bottom-up manner, expands alignment using specific code patterns, and rolls the aligned pieces into loop form.",{"name":82,"@type":73,"acceptedAnswer":83},"How do the authors decide which rolled-loop version to keep?",{"text":84,"@type":76},"They use a profitability analysis to estimate the benefit of the rolled loop before selecting the version that should remain in the code.","https://schema.org",{"og:url":52,"og:type":87,"og:title":13,"og:site_name":59,"og:description":14},"article",{"robots":89,"canonical":52},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,115,120,123,128,131,135],{"id":20,"doc_module":4,"doc_module_name":46,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":47,"doc_module":4,"doc_module_name":46,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":53,"doc_module":4,"doc_module_name":46,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":46,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":111,"doc_module":4,"doc_module_name":46,"category_name":112,"show_sort_weight":113,"slug":114},6,"Technology",50,"technology",{"id":116,"doc_module":4,"doc_module_name":46,"category_name":117,"show_sort_weight":118,"slug":119},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":46,"category_name":12,"show_sort_weight":121,"slug":122},30,"research-report",{"id":124,"doc_module":4,"doc_module_name":46,"category_name":125,"show_sort_weight":126,"slug":127},9,"Religion & Spirituality",20,"religion-spirituality",{"id":126,"doc_module":4,"doc_module_name":46,"category_name":129,"show_sort_weight":126,"slug":130},"World Cup","world-cup",{"id":132,"doc_module":4,"doc_module_name":46,"category_name":133,"show_sort_weight":132,"slug":134},10,"Lifestyle","lifestyle",{"id":136,"doc_module":4,"doc_module_name":46,"category_name":137,"show_sort_weight":106,"slug":138},19,"General","general"]