diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h --- a/llvm/include/llvm/CodeGen/SelectionDAG.h +++ b/llvm/include/llvm/CodeGen/SelectionDAG.h @@ -2119,39 +2119,34 @@ isConstantFPBuildVectorOrConstantFP(N); } - void addCallSiteInfo(const SDNode *CallNode, CallSiteInfoImpl &&CallInfo) { - SDCallSiteDbgInfo[CallNode].CSInfo = std::move(CallInfo); + /// Set CallSiteInfo to be associated with Node. + void addCallSiteInfo(const SDNode *Node, CallSiteInfoImpl &&CallInfo) { + SDCallSiteDbgInfo[Node].CSInfo = std::move(CallInfo); } - - CallSiteInfo getSDCallSiteInfo(const SDNode *CallNode) { - auto I = SDCallSiteDbgInfo.find(CallNode); - if (I != SDCallSiteDbgInfo.end()) - return std::move(I->second).CSInfo; - return CallSiteInfo(); + /// Return CallSiteInfo associated with Node, or a default if none exists. + CallSiteInfo getCallSiteInfo(const SDNode *Node) { + auto I = SDCallSiteDbgInfo.find(Node); + return I != SDCallSiteDbgInfo.end() ? std::move(I->second).CSInfo + : CallSiteInfo(); } - + /// Set HeapAllocSite to be associated with Node. void addHeapAllocSite(const SDNode *Node, MDNode *MD) { SDCallSiteDbgInfo[Node].HeapAllocSite = MD; } - - /// Return the HeapAllocSite type associated with the SDNode, if it exists. - MDNode *getHeapAllocSite(const SDNode *Node) { - auto It = SDCallSiteDbgInfo.find(Node); - if (It == SDCallSiteDbgInfo.end()) - return nullptr; - return It->second.HeapAllocSite; + /// Return HeapAllocSite associated with Node, or nullptr if none exists. + MDNode *getHeapAllocSite(const SDNode *Node) const { + auto I = SDCallSiteDbgInfo.find(Node); + return I != SDCallSiteDbgInfo.end() ? I->second.HeapAllocSite : nullptr; } - + /// Set NoMergeSiteInfo to be associated with Node if NoMerge is true. void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge) { if (NoMerge) SDCallSiteDbgInfo[Node].NoMerge = NoMerge; } - - bool getNoMergeSiteInfo(const SDNode *Node) { + /// Return NoMerge info associated with Node. + bool getNoMergeSiteInfo(const SDNode *Node) const { auto I = SDCallSiteDbgInfo.find(Node); - if (I == SDCallSiteDbgInfo.end()) - return false; - return I->second.NoMerge; + return I != SDCallSiteDbgInfo.end() ? I->second.NoMerge : false; } /// Return the current function's default denormal handling kind for the given diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp @@ -883,7 +883,7 @@ if (MI->isCandidateForCallSiteEntry() && DAG->getTarget().Options.EmitCallSiteInfo) - MF.addCallArgsForwardingRegs(MI, DAG->getSDCallSiteInfo(Node)); + MF.addCallArgsForwardingRegs(MI, DAG->getCallSiteInfo(Node)); if (DAG->getNoMergeSiteInfo(Node)) { MI->setFlag(MachineInstr::MIFlag::NoMerge);