From a1e98a443706400907987d293cceb702e5c1feed Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 2 Apr 2016 18:19:14 +0000 Subject: [PATCH] llvm_ir_generator: add TBAA metadata for @now. --- artiq/compiler/transforms/llvm_ir_generator.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/transforms/llvm_ir_generator.py b/artiq/compiler/transforms/llvm_ir_generator.py index 6de499737..e338143a0 100644 --- a/artiq/compiler/transforms/llvm_ir_generator.py +++ b/artiq/compiler/transforms/llvm_ir_generator.py @@ -154,6 +154,10 @@ class LLVMIRGenerator: self.tbaa_tree, ll.Constant(lli64, 1) ]) + self.tbaa_now = self.llmodule.add_metadata([ + ll.MetaDataString(self.llmodule, "timeline position"), + self.tbaa_tree + ]) def needs_sret(self, lltyp, may_be_large=True): if isinstance(lltyp, ll.VoidType): @@ -1050,7 +1054,9 @@ class LLVMIRGenerator: # This is an identity cast at LLVM IR level. return self.map(insn.operands[0]) elif insn.op == "now_mu": - return self.llbuilder.load(self.llbuiltin("now"), name=insn.name) + llnow = self.llbuilder.load(self.llbuiltin("now"), name=insn.name) + llnow.set_metadata("tbaa", self.tbaa_now) + return llnow elif insn.op == "at_mu": time, = insn.operands return self.llbuilder.store(self.map(time), self.llbuiltin("now")) @@ -1058,8 +1064,11 @@ class LLVMIRGenerator: interval, = insn.operands llnowptr = self.llbuiltin("now") llnow = self.llbuilder.load(llnowptr, name="now.old") + llnow.set_metadata("tbaa", self.tbaa_now) lladjusted = self.llbuilder.add(llnow, self.map(interval), name="now.new") - return self.llbuilder.store(lladjusted, llnowptr) + llnowstore = self.llbuilder.store(lladjusted, llnowptr) + llnowstore.set_metadata("tbaa", self.tbaa_now) + return llnowstore elif insn.op == "watchdog_set": interval, = insn.operands return self.llbuilder.call(self.llbuiltin("watchdog_set"), [self.map(interval)])