[GSoC'16] Weekly Status - July 3 - Zhengyang Liu

Dear LLVM and SVA community:

This is to brief you the progress of this week. Following is what I finished this week.

1. Correct the free() call insertion mistake in PromoteArrayAllocas. This piece of code seems pretty robust now and works well. I have also added detailed comments for each function as you told me. This patch can be found in [1]

2. The getenv() call causes the generated program crash. This is because the return value of getenv() is not aligned, and SAFECode will treat getenv() as a memory allocation and register it. I have also noticed strdup() call is the same as getenv(). Therefore, I created a wrapper function for getenv() and strdup(). This patch can be found in

3. Fix a bug in GEPChecks pass. The GEPChecks pass is introduced to automatically insert the safety checks to the getelementptr. Before the bugfix, GEPChecks pass can only handle getelementptr instructions with scalar return value. However, according to the LLVM Language Reference,the getelementptr returns a vector of pointers, instead of a single address, when one or more of its arguments is a vector.

<result> = getelementptr <ty>, <ptr vector> <ptrval>, <vector index type> <idx>

Therefore, I make the GEPChecks pass support this vector style getelementptr instruction.

Best regards,

Zhengyang.

`[1] ```

`[2] `````