ScaleToInt64 pass converts all loads and stores of Int32 and smaller types to Int64 to lower the temperature. This pass should come before Malloc2DynAllocaPass because it does not convert generated dynalloca.
How it works
First, it checks if there is any load/store that has bitwidth smaller than 64. If exist, it scales all malloc, alloca, and Global variable sizes. It also scales all getelementptr offsets.
Pitfalls
This problems should be covered, but it couldn't be implemented due to code length limit. It must be covered during wrap-up period. This problems are not shown in benchmark tests.
Assertions
There are some assertions that can make the program crash. But the assertions cannot be easily removed, because if the assertions are not satisfied, the program will crash elsewhere.
Assumption without assertions
It is assumed that array types are at most two dimension, like [16 x i32]. This pass doesn't assert for the dimensions. The program may crash if there are arrays with more than 2 dimensions.
Does not handle pointer operation [edit 6/10]
It will make error when there is case like int a; int *b = &a; int *c = b+1; because it only handle getelementptr offset to manage access to the pointer.
ScaleToInt64 pass [edit 6/10]
ScaleToInt64 pass converts all loads and stores of Int32 and smaller types to Int64 to lower the temperature. This pass should come before
Malloc2DynAllocaPass
because it does not convert generateddynalloca
.How it works
First, it checks if there is any load/store that has bitwidth smaller than 64. If exist, it scales all
malloc
,alloca
, and Global variable sizes. It also scales allgetelementptr
offsets.Pitfalls
This problems should be covered, but it couldn't be implemented due to code length limit. It must be covered during wrap-up period. This problems are not shown in benchmark tests.
Assertions
There are some assertions that can make the program crash. But the assertions cannot be easily removed, because if the assertions are not satisfied, the program will crash elsewhere.
Assumption without assertions
It is assumed that array types are at most two dimension, like
[16 x i32]
. This pass doesn't assert for the dimensions. The program may crash if there are arrays with more than 2 dimensions.Does not handle pointer operation [edit 6/10]
It will make error when there is case like
int a; int *b = &a; int *c = b+1;
because it only handle getelementptr offset to manage access to the pointer.