Displaying 3 results from an estimated 3 matches for "std_ld".
Did you mean:
rtdyld
2015 Jun 09
2
[LLVMdev] Constant folding inttoptr i32 0 to null pointer?
On Tue, Jun 9, 2015 at 12:32 PM, David Majnemer <david.majnemer at gmail.com>
wrote:
> 'load volatile i32 addrspace(1)* null' seems fine to me. However, it
> looks like instcombine will turn:
> define i32 @foo() {
> entry:
> %std_ld.i = load volatile i32, i32 addrspace(1)* null
> ret i32 %std_ld.i
> }
>
> into:
> define i32 @foo() {
> entry:
> %std_ld.i = load volatile i32, i32 addrspace(1)* null, align 536870912
> ret i32 %std_ld.i
> }
>
> which is not ok.
>
On second thought, I thin...
2015 Jun 09
4
[LLVMdev] Constant folding inttoptr i32 0 to null pointer?
...ant folded to null.
Here is the sequence:
Unoptimized code:
define i32 @foo() #0 {
entry:
%address.addr.i = alloca i32, align 4
%value.i = alloca i32, align 4
store i32 0, i32* %address.addr.i, align 4
%0 = load i32* %address.addr.i, align 4
%1 = inttoptr i32 %0 to i32 addrspace(1)*
%std_ld.i = load volatile i32 addrspace(1)* %1
store i32 %std_ld.i, i32* %value.i, align 4
%2 = load i32* %value.i, align 4
ret i32 %2
}
After optimization (early CSE):
define i32 @foo() #0 {
entry:
%std_ld.i = load volatile i32 addrspace(1)* null, align 536870912
ret i32 %std_ld.i
}
The conta...
2015 Jun 09
2
[LLVMdev] Constant folding inttoptr i32 0 to null pointer?
Hello,
It seems that ConstantFoldCastInstruction in ConstantFold.cpp folds inttoptr instruction with 0 as operand to a null pointer. It makes sense, when talking about a C-style frontend, as the C99 spec (6.3.2.3) states:
"An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant."
On the other hand, some architectures