forked from M-Labs/artiq
1
0
Fork 0

compiler: mark loads of kernel constant attributes as load invariant.

Also, enable LICM, since it can take advantage of this.
This commit is contained in:
whitequark 2016-03-28 00:44:32 +00:00 committed by Sebastien Bourdeauducq
parent 081edb27d7
commit 0e0f81b509
2 changed files with 4 additions and 1 deletions

View File

@ -105,6 +105,7 @@ class Target:
llpassmgr.add_instruction_combining_pass()
llpassmgr.add_gvn_pass()
llpassmgr.add_cfg_simplification_pass()
llpassmgr.add_licm_pass()
# Clean up after optimizing.
llpassmgr.add_dead_arg_elimination_pass()

View File

@ -796,7 +796,9 @@ class LLVMIRGenerator:
else:
llptr = self.llbuilder.gep(obj, [self.llindex(0), self.llindex(index)],
inbounds=True, name="ptr.{}".format(insn.name))
return self.llbuilder.load(llptr, name="val.{}".format(insn.name))
llval = self.llbuilder.load(llptr, name="val.{}".format(insn.name))
llval.metadata['invariant.load'] = self.empty_metadata
return llval
def process_SetAttr(self, insn):
typ, attr = insn.object().type, insn.attr