[LLVMdev] Eliminate stores with __builtin_assume (original) (raw)
Philip Reames listmail at philipreames.com
Fri Jul 3 13:50:18 PDT 2015
- Previous message: [LLVMdev] Eliminate stores with __builtin_assume
- Next message: [LLVMdev] Sequence of BuildMI without order dependency
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I don't believe that anyone has explored using assumes for modeling
memory. Doing so seems reasonable, but would require some careful
thought. The place to start looking would be the GVN pass.
Specifically, look at the handling for full redundancy cases. Looking
at what we do for known functions (i.e. malloc, calloc) might be a
reasonable place to start reading.
Philip
On 07/03/2015 03:55 AM, Tom Aernoudt wrote:
Hi all, _Is it possible to use builtinassume (or something similar like _builtinunreachable) to eliminate stores? Eg I would expect that I if I write something as follows the optimizer could optimize away the store to the variable a: void foo(int* a) { _builtinassume(*a == 0); *a = 0; } But the generated code still writes to the variable: ; Function Attrs: nounwind uwtable define void @Z3fooPi(i32* nocapture %a) #0 { %1 = load i32, i32* %a, align 4, !tbaa !8 %2 = icmp eq i32 %1, 0 tail call void @llvm.assume(i1 %2) store i32 0, i32* %a, align 4, !tbaa !8 ret void } 00000000000000a0 : a0: c7 07 00 00 00 00 movl $0x0,(%rdi) a6: c3 retq Why this store not optimized away? Is there another way to tell the optimizer that the store can be eliminated? Regards, Tom
LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150703/86c55262/attachment.html>
- Previous message: [LLVMdev] Eliminate stores with __builtin_assume
- Next message: [LLVMdev] Sequence of BuildMI without order dependency
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]