As the function DecomposeGEPExpression said,if const Value V is a symbolic pointer expression, decompose it into a base pointer with a constant offset and a number of scaled symbolic offsets.
Usually it is right,but once in 32bit poiter,and the offset is 0x80000000(0x80000000+0x80000000),
the result sounds not right.
In my case,the IR series like this:
%a.sroa.0.0.idx= getelementptr inbouds[1x%union.int_union]*a,i32 -13421778,i32 -13421778
As the result,the BaseOffs is -13421778(0x80000000) + -13421778(0x80000000)=0x100000000.
They point to different addresses,so there isn’t alias between them.But in actual situation,for 32bit
target(such as i586),0x100000000 is overflow,the actual result is -13421778(0x80000000) +
I try to trunk BaseOffs for 32bit target like this,am i right?
- if(TD->getPoitersizeInBits() == 32)
- BaseOffs = (int32_t) BaseOffs;
I would appreciate any suggestions on this.Thanks very much!