You can neglect the following environment setup process by sshing to the ws1 and directly jump to Build Instructions part.
- LLVM Version: Ensure the LLVM version is 12 or higher installed on the system.
- Installation:
sudo apt-get update
sudo apt-get install llvm-12 llvm-12-dev clang-12
- CMake: Version 3.13.4 or higher.
- LLVM: Ensure
LLVM_DIRis set to the correct LLVM installation path.
- Set the LLVM_DIR environment variable to the path of your LLVM installation:
export LLVM_DIR=/usr/lib/llvm-12/cmake - Ensure your PATH includes the LLVM binaries:
export PATH=/usr/lib/llvm-12/bin:$PATH
- Clone the repository and navigate to the directory:
cd code
cd src
- Create a build directory and navigate to it:
mkdir build
cd build
- Run cmake to configure the project:
cmake ..
- Build the project:
make
- Ensure you are in
testsdirectory. - Execute the command:
bash run_simple.sh
- Then, it would generate
test.opt.llandtest2.opt.llin thetestsdirectory. - Verify the output IR file
test.opt.ll(compare withtest.ll)to ensure the optimizations are applied. - Verify the output IR file
test2.opt.ll(compare withtest2.ll)to ensure the optimizations are applied.
- Navigate to the
testsdirectory. - Execute:
bash run_bench.sh - Then, it would show the following result:
Running benchmark with unoptimized version...
Constant Folding Test: Time = 0.000014 seconds, Result = 84000
Strength Reduction Test: Time = 0.000009 seconds, Result = 31968000
Algebraic Identities Test: Time = 0.000012 seconds, Result = 42000
Mixed Optimizations Test: Time = 0.000009 seconds, Result = 30720000
Matrix Multiplication Test: Time = 0.000333 seconds, Result = 63360000
Running benchmark with optimized version...
Constant Folding Test: Time = 0.000008 seconds, Result = 84000
Strength Reduction Test: Time = 0.000006 seconds, Result = 31968000
Algebraic Identities Test: Time = 0.000006 seconds, Result = 42000
Mixed Optimizations Test: Time = 0.000005 seconds, Result = 30720000
Matrix Multiplication Test: Time = 0.000203 seconds, Result = 63360000