Project Stage 2 (Part 4): Testing and Results

  Testing the Pass

With the logic in place, I tested the pass using the provided test cases.


1. Extracting the Test Cases

cp /public/spo600-test-clone.tgz ~/test-clone cd ~/test-clone tar -xvf spo600-test-clone.tgz

2. Compiling the Test Programs
Then I used the modified GCC, I compiled the test programs:

~/gcc-install/bin/gcc -fdump-tree-ctyler test-clone-arch-prune.c -o prune-test ~/gcc-install/bin/gcc -fdump-tree-ctyler test-clone-arch-noprune.c -o noprune-test


3. Results

With test case : test-clone-arch-prune. This test involved two functions that were equivalent after optimizations. The expectiation was for the pass to emit the message:

PRUNE: test_function

indicating that the clone could be safely removed.

The .ctytler dump file showed:
PRUNE: test_function

And to the test case 
test-clone-arch-noprune. The expected diagnostic message was 
NOPRUNE: test_function
Unfortunately, this test did not pass as expected

Challenges

Gimple Variations: The pass misinterpreted minor IR differences (e.g., variable names) as equivalence.

Simplistic Logic: The statement comparison lacked depth, missing subtle differences.


Reflections

Despite the partial success, the project offered valuable insights into GCC’s IR and pipeline. The failure highlighted the need for better comparison strategies, such as deeper operand checks or hash-based function analysis. These lessons will guide future improvements to the pass.


Final Thoughts

Although the Clone-Pruning Analysis Pass was only partially successful, the project provided valuable insights into compiler design and intermediate representation analysis. Debugging the issues has paved the way for future improvements, and I’m eager to refine the pass further. The challenges faced underscored the complexity of real-world compiler development but also highlighted its rewards.

Nhận xét

Bài đăng phổ biến từ blog này

Project Stage 2 (Part 2): Set Up GCC for My Clone-Pruning Pass

Project Stage 2 (Part 3): Implementing the Clone-Pruning Logic

SPO600 - Lab 3: 6502 Program Lab: Inches to Feet Converter