Skip to content

Commit 418f0a5

Browse files
author
whitequark
committedMar 28, 2016
compiler: mark loads of kernel constant attributes as load invariant.
Also, enable LICM, since it can take advantage of this.
1 parent 507ad96 commit 418f0a5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

‎artiq/compiler/targets.py

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def optimize(self, llmodule):
105105
llpassmgr.add_instruction_combining_pass()
106106
llpassmgr.add_gvn_pass()
107107
llpassmgr.add_cfg_simplification_pass()
108+
llpassmgr.add_licm_pass()
108109

109110
# Clean up after optimizing.
110111
llpassmgr.add_dead_arg_elimination_pass()

‎artiq/compiler/transforms/llvm_ir_generator.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,9 @@ def process_GetAttr(self, insn):
796796
else:
797797
llptr = self.llbuilder.gep(obj, [self.llindex(0), self.llindex(index)],
798798
inbounds=True, name="ptr.{}".format(insn.name))
799-
return self.llbuilder.load(llptr, name="val.{}".format(insn.name))
799+
llval = self.llbuilder.load(llptr, name="val.{}".format(insn.name))
800+
llval.metadata['invariant.load'] = self.empty_metadata
801+
return llval
800802

801803
def process_SetAttr(self, insn):
802804
typ, attr = insn.object().type, insn.attr

0 commit comments

Comments
 (0)
Please sign in to comment.