numba / llvmlite

A lightweight LLVM python binding for writing JIT compilers
https://llvmlite.pydata.org/
BSD 2-Clause "Simplified" License
1.94k stars 322 forks source link

Add target attributes to LLVM IR Module getting optimized #1103

Open yashssh opened 3 days ago

yashssh commented 3 days ago

LLVM IR that is passed down from Numba frontend to LLVM backend does not contain some basic target specific attributes(target-cpu, target-features) which is added by Clang frontend (when compiling C++) or either by tools such as opt and llc when optimizing the LLVM-IR directly with the help of cli flags.

I have mimicked the flow of opt optimizer from llvm, which adds these details to the IR module before running the optimization pipeline.

This change shouldn't affect any functionality and correctness, it's just to add more details to the IR involved and to make it more more verbose and portable across tools.