Which optimizer would remove duplicate, or unneeded loads? In my generator I end up having a lot of the same load. For example here I keep loading "@pt" which will always be the same value. %16 = load %1** @pt, align 8 %17 = getelementptr inbounds %1* %16, i64 0, i32 2, i32 0 %18 = load i32* %17, align 4 call void @trace_integer(i32 %18) %19 = load %1** @pt, align 8 %20 = getelementptr inbounds %1* %19, i64 0, i32 2, i32 1 %21 = load i32* %20, align 4 call void @trace_integer(i32 %21) %22 = load %1** @pt, align 8 %23 = getelementptr inbounds %1* %22, i64 0, i32 0 -- edA-qa mort-ora-y -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Sign: Please digitally sign your emails. Encrypt: I'm also happy to receive encrypted mail. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 261 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130224/75f66349/attachment.sig>
Hi, On 24/02/13 06:48, edA-qa mort-ora-y wrote:> Which optimizer would remove duplicate, or unneeded loads? In my > generator I end up having a lot of the same load. For example here I > keep loading "@pt" which will always be the same value.in order to do this, the optimizers need to know that the call to @trace_integer does not modify the contents of @pt. Is it logically possible for them to deduce this? If not, no optimizer can do what you want. Ciao, Duncan.> > %16 = load %1** @pt, align 8 > %17 = getelementptr inbounds %1* %16, i64 0, i32 2, i32 0 > %18 = load i32* %17, align 4 > call void @trace_integer(i32 %18) > %19 = load %1** @pt, align 8 > %20 = getelementptr inbounds %1* %19, i64 0, i32 2, i32 1 > %21 = load i32* %20, align 4 > call void @trace_integer(i32 %21) > %22 = load %1** @pt, align 8 > %23 = getelementptr inbounds %1* %22, i64 0, i32 0 > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On 24/02/13 09:02, Duncan Sands wrote:> in order to do this, the optimizers need to know that the call to > @trace_integer does not modify the contents of @pt. Is it logically > possible for them to deduce this? If not, no optimizer can do what > you want.Yeah, I thought about that and then realized in this context they could not (it's an external function). Is there some attribute I can mark the functions with however that would allow the optimizers to understand it's safe not to reload? -- edA-qa mort-ora-y -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Sign: Please digitally sign your emails. Encrypt: I'm also happy to receive encrypted mail. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 261 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130224/00de6c27/attachment.sig>
Possibly Parallel Threads
- [LLVMdev] Optimizer to remove duplicate loads?
- [LLVMdev] Optimizer to remove duplicate loads?
- [LLVMdev] alignment issue, getting corrupt double values
- [LLVMdev] object file/linking is missing my exception handlers
- [LLVMdev] post-link Dwarf information appears wrong, works in JIT