[PATCH] Constant Hoisting Pass

Juergen Ributzka juergen at apple.com
Thu Jan 23 15:22:30 PST 2014


Hi Paul, Eric, and Adrian,

the constant hoisting pass is only enabled starting with optimization level -O1 - the same as for CodeGenPrepare. It won’t interfere with -O0 debug builds. 

I also don’t want to make the debugger life more difficult and after checking with Adrian I updated the patch to also add debug locations (I just simply forgot them).
I just copy the debug location from the instruction I generate the rematerialization code for, because they belong together. For the hoisted constants I don’t have a single debug location anymore to pin them to, so I just use the debug location from the following instruction.

What you guy think?

Cheers,
Juergen




On Jan 23, 2014, at 11:26 AM, Robinson, Paul <Paul_Robinson at playstation.sony.com> wrote:

>> -----Original Message-----
>> From: Adrian Prantl [mailto:aprantl at apple.com]
>> Sent: Thursday, January 23, 2014 11:13 AM
>> To: Robinson, Paul
>> Cc: Juergen Ributzka; LLVM Commits; Owen Anderson; Eric Christopher
>> Subject: Re: [PATCH] Constant Hoisting Pass
>> 
>> 
>> On Jan 22, 2014, at 18:05, Robinson, Paul
>> <Paul_Robinson at playstation.sony.com> wrote:
>> 
>>> With this kind of thing, I get concerned that moving stuff around will
>> cause unnecessary chaos with debug info.  But it looks like the new
>> instructions you're creating don't have a source location attached?  In
>> this case that's probably the right thing to do.  Let me know if I'm
>> misunderstanding what's going on here.
>> 
>> Not attaching any location will create a hole in the function, which is
>> also not ideal. I've seen this cause interesting problems with inlining
>> where the debugger then has no chance to know which of the abstract
>> subroutines an instruction belongs to and stepping totally breaks.
> 
> Hm.  Machine instructions with no explicit location will implicitly
> inherit the location of the preceding instruction.[*]  Is that not what
> happens with IR instructions?
> --paulr
> 
> [*] This is not great when the preceding instruction is in a different
> block, and I've poked at that from time to time. But is a digression from
> this discussion.
> 
>> 
>> If there really is no useful location for an instruction, IMHO it should
>> get a location pointing to line 0 + a valid scope that belongs to the
>> function. In Clang we have ArtificialLocation for this which is used for
>> the helper functions emitted for Blocks in Objective C.
>> 
>> -- adrian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140123/fd242e17/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Add-Constant-Hoisting-Pass-v2.patch
Type: application/octet-stream
Size: 47390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140123/fd242e17/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140123/fd242e17/attachment-0001.html>


More information about the llvm-commits mailing list