Issue |
142968
|
Summary |
Why can't "const xxx *restrict" be optimized?
|
Labels |
new issue
|
Assignees |
|
Reporter |
lvyitianshi
|
Why can't "const xxx *restrict" be optimized?
I'm sorry because I can't write makedown.
This is c code:
__attribute__((malloc)) int *get();
void _interface0(int p);
void _interface1(const int *restrict p);
int entry() {
int *p = get();
_interface0(*p);
_interface1(p);
_interface0(*p);
_interface1(p);
_interface0(*p);
_interface1(p);
_interface0(*p);
_interface1(p);
_interface0(*p);
_interface1(p);
return 0;
}
This is command line:
clang -S -O3 main.c -ffreestanding
This is assemble code:
.def @feat.00;
.scl 3;
.type 0;
.endef
.globl @feat.00
.set @feat.00, 0
.file "main.c"
.def entry;
.scl 2;
.type 32;
.endef
.text
.globl entry # -- Begin function entry
.p2align 4
entry: # @entry
# %bb.0:
pushq %rsi
subq $32, %rsp
callq get
movq %rax, %rsi
movl (%rax), %ecx
callq _interface0
movq %rsi, %rcx
callq _interface1
movl (%rsi), %ecx
callq _interface0
movq %rsi, %rcx
callq _interface1
movl (%rsi), %ecx
callq _interface0
movq %rsi, %rcx
callq _interface1
movl (%rsi), %ecx
callq _interface0
movq %rsi, %rcx
callq _interface1
movl (%rsi), %ecx
callq _interface0
movq %rsi, %rcx
callq _interface1
xorl %eax, %eax
addq $32, %rsp
popq %rsi
retq
# -- End function
.addrsig
Why p can't be optimized into the registers?
Can someone tell me how to do it, I know "pure" does my thing, but it needs not to return void.
If no one realizes that this is a point that can be optimized, I hope someone will pay attention:)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs