{"id":26717776,"url":"https://github.com/auyxs/llvm-optimizations","last_synced_at":"2026-05-02T14:36:42.573Z","repository":{"id":284648764,"uuid":"954313789","full_name":"Auyxs/llvm-optimizations","owner":"Auyxs","description":"UNIMORE Compilers Course 2024/25 - collection of assignments","archived":false,"fork":false,"pushed_at":"2025-03-26T23:57:30.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T00:29:19.254Z","etag":null,"topics":["compilers","llvm","llvm-ir"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Auyxs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-24T22:25:35.000Z","updated_at":"2025-03-26T23:57:34.000Z","dependencies_parsed_at":"2025-03-27T00:40:40.937Z","dependency_job_id":null,"html_url":"https://github.com/Auyxs/llvm-optimizations","commit_stats":null,"previous_names":["auyxs/llvm-optimizations"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Auyxs%2Fllvm-optimizations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Auyxs%2Fllvm-optimizations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Auyxs%2Fllvm-optimizations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Auyxs%2Fllvm-optimizations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Auyxs","download_url":"https://codeload.github.com/Auyxs/llvm-optimizations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245879952,"owners_count":20687459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compilers","llvm","llvm-ir"],"created_at":"2025-03-27T16:23:42.922Z","updated_at":"2026-05-02T14:36:42.398Z","avatar_url":"https://github.com/Auyxs.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLVM Optimization Passes\n\n[![LLVM Version](https://img.shields.io/badge/LLVM-19.1.7-orange.svg)](https://llvm.org/)\n![License](https://img.shields.io/badge/License-MIT-blue.svg)\n\nRepository containing Compilers Course assignments at **Unimore (2024/2025)** - Implementation of **LLVM IR** optimization passes as plugins.\n\n## 📂 First Assignment \n\n1. **Algebraic Identity**\n    - `x + 0` → `x`\n    - `1 × 𝑥` → `x`\n\n2. **Strength Reduction**\n    - `15 × 𝑥 = 𝑥 × 15` → `(𝑥 ≪ 4) – x`\n    - `y = x / 8` → `y = x \u003e\u003e 3`\n\n3. **Multi-Instruction Optimization**\n    - `𝑎 = 𝑏 + 1, 𝑐 = 𝑎 − 1` → `𝑎 = 𝑏 + 1, 𝑐 = b`\n\n### Usage\n\n#### 🔧 Build\nTo build the LLVM plugin, follow these steps:\n```bash\nmkdir -p build\ncd build\ncmake -DLT_LLVM_INSTALL_DIR=$LLVM_DIR /path/to/assignment-01\nmake\n```\nThe plugin (`libLocalOpts.so`) will be generated in the build directory.\n\u003e Note : Ensure that $LLVM_DIR is correctly set to your LLVM installation path. \n\u003e (e.g., /usr/lib/llvm-19/bin on Linux)\n#### ▶️ Run Optimization Pass\nOnce the plugin is built, you can run the optimization script to test the implemented passes:\n1. Place your `.cpp` test files in the `test/cpp` directory.\n2. Before running the script, set the `OPT_PLUGIN_PATH` environment variable:\n```bash\nexport OPT_PLUGIN_PATH=/path/to/libLocalOpts.so\n```\n3. Make the script executable and run it:\n```bash\nchmod +x run_opt.sh\n./run_opt.sh\n```\n## 📂 Second Assignment - Dataflow Analysis\n\u003e Note: no code implementation required\n1. **Very Busy Expressions**\n2. **Dominator Analysis**\n3. **Constant Propagation**\n\n## Contributors\n- Aurora Lin\n- Eleonora Muzzi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauyxs%2Fllvm-optimizations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauyxs%2Fllvm-optimizations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauyxs%2Fllvm-optimizations/lists"}