From 4ac0e8da4a819b2db09659262227e8c8f7f1fcc0 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Thu, 22 Nov 2007 03:07:37 +0000 Subject: [PATCH] Create nodes for inline asm so that we don't crash looking for the node later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44267 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/IPA/Andersens.cpp | 8 ++++++++ test/Analysis/Andersens/2007-11-19-InlineAsm.ll | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/Analysis/Andersens/2007-11-19-InlineAsm.ll diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index 08b9dc3de22..da4fa82f06a 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -668,6 +668,14 @@ void Andersens::IdentifyObjects(Module &M) { if (AllocationInst *AI = dyn_cast(&*II)) ObjectNodes[AI] = NumObjects++; } + + // Calls to inline asm need to be added as well because the callee isn't + // referenced anywhere else. + if (CallInst *CI = dyn_cast(&*II)) { + Value *Callee = CI->getCalledValue(); + if (isa(Callee)) + ValueNodes[Callee] = NumObjects++; + } } } diff --git a/test/Analysis/Andersens/2007-11-19-InlineAsm.ll b/test/Analysis/Andersens/2007-11-19-InlineAsm.ll new file mode 100644 index 00000000000..c1ab6c7b1a4 --- /dev/null +++ b/test/Analysis/Andersens/2007-11-19-InlineAsm.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | opt -anders-aa -disable-output + +define void @x(i16 %Y) { +entry: + %tmp = call i16 asm "bswap $0", "=r,r"(i16 %Y) + ret void +} + -- 2.34.1