From ae272d718e882b18258a587ce111a4150d761b5e Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Thu, 31 Mar 2016 21:29:57 +0000 Subject: [NVPTX] Infer __nvvm_reflect as nounwind, readnone This patch simply mirrors the attributes we give to @llvm.nvvm.reflect to the __nvvm_reflect libdevice call. This shaves about 30% of the code in libdevice away because of CSE opportunities. It's also helps us figure out that libdevice implementations of transcendental functions don't have side-effects. llvm-svn: 265060 --- llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp') diff --git a/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp b/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp index 16922ab9256..030a6464522 100644 --- a/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp +++ b/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp @@ -924,6 +924,15 @@ static bool inferPrototypeAttributes(Function &F, Changed |= setOnlyReadsMemory(F, 2); return Changed; + // int __nvvm_reflect(const char *) + case LibFunc::nvvm_reflect: + if (FTy->getNumParams() != 1 || !isa(FTy->getParamType(0))) + return false; + + Changed |= setDoesNotAccessMemory(F); + Changed |= setDoesNotThrow(F); + return Changed; + default: // FIXME: It'd be really nice to cover all the library functions we're // aware of here. -- cgit v1.2.3