From e67d23905f1cbcb88111b8ac7ed9f27e50bde510 Mon Sep 17 00:00:00 2001 From: Kristina Brooks Date: Mon, 21 Jan 2019 04:36:43 +0000 Subject: [PATCH] [llgo]: fix compilation under current llvm Patch rL322965 changed how intrinsics for memset and memzero were defined. This causes a regression in LLGO making it no longer buidable. In addition to that one pass was renamed, so this also addresses the pass naming disparity. I removed all split stack related bits from this patch as as asked. Differential Revision: https://reviews.llvm.org/D56638 llvm-svn: 351722 --- llgo/cmd/gllgo/gllgo.go | 2 +- llgo/irgen/runtime.go | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/llgo/cmd/gllgo/gllgo.go b/llgo/cmd/gllgo/gllgo.go index 9147e393e751..cef90c074c52 100644 --- a/llgo/cmd/gllgo/gllgo.go +++ b/llgo/cmd/gllgo/gllgo.go @@ -117,7 +117,7 @@ func (san *sanitizerOptions) addPasses(mpm, fpm llvm.PassManager) { case san.thread: mpm.AddThreadSanitizerPass() case san.memory: - mpm.AddMemorySanitizerPass() + mpm.AddMemorySanitizerLegacyPassPass() case san.dataflow: blacklist := san.blacklist if blacklist == "" { diff --git a/llgo/irgen/runtime.go b/llgo/irgen/runtime.go index 485a2d3eb0ef..3731ff1880c2 100644 --- a/llgo/irgen/runtime.go +++ b/llgo/irgen/runtime.go @@ -517,7 +517,6 @@ func newRuntimeInterface(module llvm.Module, tm *llvmTypeMap) (*runtimeInterface llvm.PointerType(llvm.Int8Type(), 0), llvm.Int8Type(), tm.target.IntPtrType(), - llvm.Int32Type(), llvm.Int1Type(), }, false, @@ -530,8 +529,7 @@ func newRuntimeInterface(module llvm.Module, tm *llvmTypeMap) (*runtimeInterface []llvm.Type{ llvm.PointerType(llvm.Int8Type(), 0), llvm.PointerType(llvm.Int8Type(), 0), - tm.target.IntPtrType(), - llvm.Int32Type(), + llvm.Int64Type(), llvm.Int1Type(), }, false, @@ -589,9 +587,8 @@ func (fr *frame) memsetZero(ptr llvm.Value, size llvm.Value) { ptr = fr.builder.CreateBitCast(ptr, llvm.PointerType(llvm.Int8Type(), 0), "") fill := llvm.ConstNull(llvm.Int8Type()) size = fr.createZExtOrTrunc(size, fr.target.IntPtrType(), "") - align := llvm.ConstInt(llvm.Int32Type(), 1, false) isvolatile := llvm.ConstNull(llvm.Int1Type()) - fr.builder.CreateCall(memset, []llvm.Value{ptr, fill, size, align, isvolatile}, "") + fr.builder.CreateCall(memset, []llvm.Value{ptr, fill, size, isvolatile}, "") } func (fr *frame) memcpy(dest llvm.Value, src llvm.Value, size llvm.Value) { @@ -599,9 +596,8 @@ func (fr *frame) memcpy(dest llvm.Value, src llvm.Value, size llvm.Value) { dest = fr.builder.CreateBitCast(dest, llvm.PointerType(llvm.Int8Type(), 0), "") src = fr.builder.CreateBitCast(src, llvm.PointerType(llvm.Int8Type(), 0), "") size = fr.createZExtOrTrunc(size, fr.target.IntPtrType(), "") - align := llvm.ConstInt(llvm.Int32Type(), 1, false) isvolatile := llvm.ConstNull(llvm.Int1Type()) - fr.builder.CreateCall(memcpy, []llvm.Value{dest, src, size, align, isvolatile}, "") + fr.builder.CreateCall(memcpy, []llvm.Value{dest, src, size, isvolatile}, "") } func (fr *frame) returnAddress(level uint64) llvm.Value {