[llvm] r237237 - [DebugInfo] Debug locations for constant SD nodes
David Blaikie
dblaikie at gmail.com
Fri May 29 15:22:59 PDT 2015
On Wed, May 13, 2015 at 1:58 AM, Sergey Dmitrouk <sdmitrouk at accesssoftek.com
> wrote:
> Author: sdmitrouk
> Date: Wed May 13 03:58:03 2015
> New Revision: 237237
>
> URL: http://llvm.org/viewvc/llvm-project?rev=237237&view=rev
> Log:
> [DebugInfo] Debug locations for constant SD nodes
>
> Several updates for [DebugInfo] Add debug locations to constant SD nodes
> (r235989).
> Includes:
>
> * re-enabling the change (disabled recently);
> * missing change for FP constants;
> * resetting debug location of constant node if it's used more than at
> one place
> to prevent emission of wrong locations in case of coalesced constants;
> * a couple of additional tests.
>
> Now all look ups in CSEMap are wrapped by additional method.
>
> Comment in D9084 suggests that debug locations aren't useful for "target
> constants",
> so there might be one more change related to this API (namely, dropping
> debug
> locations for getTarget*Constant methods).
>
This still seems to have some oddities that are increasing the size of
-gmlt in particular by creating discontiguous instruction ranges for
inlined subroutines in ways that are possibly incorrect-ish.
Take this example:
volatile int x;
int y;
static __attribute__((always_inline)) int f1() {
if (x * 3 < 14) return 1;
return 2;
}
int main() {
x = f1();
x = x ? 1 : 2;
}
& the assembly difference: https://www.diffchecker.com/p2ladh2w
What happens is that the 1 stored to x from the inlined f1() ends up being
emitted indirectly (in this particular instance - setg/movzbl/incl so if
the condition is false it's 1 + 1 and if it's true it's 0 + 1) so when the
1 is needed in main it's emitted directly there, but still attributed to
the location inside f1.
Does this still qualify as two uses of the constant '1' & should not get
locations? Or does that first indirect emission not count as a use at this
level - yet we somehow still use that use's location for the other use... ?
>
> Differential Revision: http://reviews.llvm.org/D9604
>
> Added:
> llvm/trunk/test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll
> llvm/trunk/test/DebugInfo/ARM/single-constant-use-preserves-dbgloc.ll
> llvm/trunk/test/DebugInfo/constantfp-sdnodes-have-dbg-location.ll
> Modified:
> llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
> llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> llvm/trunk/test/DebugInfo/AArch64/constant-dbgloc.ll
> llvm/trunk/test/DebugInfo/ARM/constant-dbgloc.ll
> llvm/trunk/test/DebugInfo/constant-sdnodes-have-dbg-location.ll
>
> Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=237237&r1=237236&r2=237237&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed May 13 03:58:03 2015
> @@ -1243,6 +1243,18 @@ private:
> SDValue N1, SDValue N2,
> const SDNodeFlags *Flags = nullptr);
>
> + /// Look up the node specified by ID in CSEMap. If it exists, return
> it. If
> + /// not, return the insertion token that will make insertion faster.
> This
> + /// overload is for nodes other than Constant or ConstantFP, use the
> other one
> + /// for those.
> + SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void
> *&InsertPos);
> +
> + /// Look up the node specified by ID in CSEMap. If it exists, return
> it. If
> + /// not, return the insertion token that will make insertion faster.
> Performs
> + /// additional processing for constant nodes.
> + SDNode *FindNodeOrInsertPos(const FoldingSetNodeID &ID, DebugLoc DL,
> + void *&InsertPos);
> +
> /// List of non-single value types.
> FoldingSet<SDVTListNode> VTListMap;
>
>
> Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=237237&r1=237236&r2=237237&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Wed May 13
> 03:58:03 2015
> @@ -1406,11 +1406,10 @@ public:
> class ConstantSDNode : public SDNode {
> const ConstantInt *Value;
> friend class SelectionDAG;
> - // XXX: DebugLoc is unused intentionally until constant coalescing is
> resolved
> ConstantSDNode(bool isTarget, bool isOpaque, const ConstantInt *val,
> - DebugLoc, EVT VT)
> + DebugLoc DL, EVT VT)
> : SDNode(isTarget ? ISD::TargetConstant : ISD::Constant,
> - 0, DebugLoc(), getSDVTList(VT)), Value(val) {
> + 0, DL, getSDVTList(VT)), Value(val) {
> SubclassData |= (uint16_t)isOpaque;
> }
> public:
> @@ -1435,9 +1434,9 @@ public:
> class ConstantFPSDNode : public SDNode {
> const ConstantFP *Value;
> friend class SelectionDAG;
> - ConstantFPSDNode(bool isTarget, const ConstantFP *val, EVT VT)
> + ConstantFPSDNode(bool isTarget, const ConstantFP *val, DebugLoc DL, EVT
> VT)
> : SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP,
> - 0, DebugLoc(), getSDVTList(VT)), Value(val) {
> + 0, DL, getSDVTList(VT)), Value(val) {
> }
> public:
>
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=237237&r1=237236&r2=237237&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed May 13
> 03:58:03 2015
> @@ -868,7 +868,7 @@ SDNode *SelectionDAG::FindModifiedNodeSl
> FoldingSetNodeID ID;
> AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops);
> AddNodeIDCustom(ID, N);
> - SDNode *Node = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
> + SDNode *Node = FindNodeOrInsertPos(ID, N->getDebugLoc(), InsertPos);
> return Node;
> }
>
> @@ -886,7 +886,7 @@ SDNode *SelectionDAG::FindModifiedNodeSl
> FoldingSetNodeID ID;
> AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops);
> AddNodeIDCustom(ID, N);
> - SDNode *Node = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
> + SDNode *Node = FindNodeOrInsertPos(ID, N->getDebugLoc(), InsertPos);
> return Node;
> }
>
> @@ -903,7 +903,7 @@ SDNode *SelectionDAG::FindModifiedNodeSl
> FoldingSetNodeID ID;
> AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Ops);
> AddNodeIDCustom(ID, N);
> - SDNode *Node = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
> + SDNode *Node = FindNodeOrInsertPos(ID, N->getDebugLoc(), InsertPos);
> return Node;
> }
>
> @@ -969,6 +969,40 @@ BinarySDNode *SelectionDAG::GetBinarySDN
> return N;
> }
>
> +SDNode *SelectionDAG::FindNodeOrInsertPos(const FoldingSetNodeID &ID,
> + void *&InsertPos) {
> + SDNode *N = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
> + if (N) {
> + switch (N->getOpcode()) {
> + default: break;
> + case ISD::Constant:
> + case ISD::ConstantFP:
> + llvm_unreachable("Querying for Constant and ConstantFP nodes
> requires "
> + "debug location. Use another overload.");
> + }
> + }
> + return N;
> +}
> +
> +SDNode *SelectionDAG::FindNodeOrInsertPos(const FoldingSetNodeID &ID,
> + DebugLoc DL, void *&InsertPos) {
> + SDNode *N = CSEMap.FindNodeOrInsertPos(ID, InsertPos);
> + if (N) {
> + switch (N->getOpcode()) {
> + default: break; // Process only regular (non-target) constant nodes.
> + case ISD::Constant:
> + case ISD::ConstantFP:
> + // Erase debug location from the node if the node is used at several
> + // different places to do not propagate one location to all uses as
> it
> + // leads to incorrect debug info.
> + if (N->getDebugLoc() != DL)
> + N->setDebugLoc(DebugLoc());
> + break;
> + }
> + }
> + return N;
> +}
> +
> void SelectionDAG::clear() {
> allnodes_clear();
> OperandAllocator.Reset();
> @@ -1172,7 +1206,7 @@ SDValue SelectionDAG::getConstant(const
> ID.AddBoolean(isO);
> void *IP = nullptr;
> SDNode *N = nullptr;
> - if ((N = CSEMap.FindNodeOrInsertPos(ID, IP)))
> + if ((N = FindNodeOrInsertPos(ID, DL.getDebugLoc(), IP)))
> if (!VT.isVector())
> return SDValue(N, 0);
>
> @@ -1216,12 +1250,13 @@ SDValue SelectionDAG::getConstantFP(cons
> ID.AddPointer(&V);
> void *IP = nullptr;
> SDNode *N = nullptr;
> - if ((N = CSEMap.FindNodeOrInsertPos(ID, IP)))
> + if ((N = FindNodeOrInsertPos(ID, DL.getDebugLoc(), IP)))
> if (!VT.isVector())
> return SDValue(N, 0);
>
> if (!N) {
> - N = new (NodeAllocator) ConstantFPSDNode(isTarget, &V, EltVT);
> + N = new (NodeAllocator) ConstantFPSDNode(isTarget, &V,
> DL.getDebugLoc(),
> + EltVT);
> CSEMap.InsertNode(N, IP);
> InsertNode(N);
> }
> @@ -1278,7 +1313,7 @@ SDValue SelectionDAG::getGlobalAddress(c
> ID.AddInteger(TargetFlags);
> ID.AddInteger(GV->getType()->getAddressSpace());
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, DL.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) GlobalAddressSDNode(Opc,
> DL.getIROrder(),
> @@ -1295,7 +1330,7 @@ SDValue SelectionDAG::getFrameIndex(int
> AddNodeIDNode(ID, Opc, getVTList(VT), None);
> ID.AddInteger(FI);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) FrameIndexSDNode(FI, VT, isTarget);
> @@ -1314,7 +1349,7 @@ SDValue SelectionDAG::getJumpTable(int J
> ID.AddInteger(JTI);
> ID.AddInteger(TargetFlags);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) JumpTableSDNode(JTI, VT, isTarget,
> @@ -1340,7 +1375,7 @@ SDValue SelectionDAG::getConstantPool(co
> ID.AddPointer(C);
> ID.AddInteger(TargetFlags);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) ConstantPoolSDNode(isTarget, C, VT,
> Offset,
> @@ -1367,7 +1402,7 @@ SDValue SelectionDAG::getConstantPool(Ma
> C->addSelectionDAGCSEId(ID);
> ID.AddInteger(TargetFlags);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) ConstantPoolSDNode(isTarget, C, VT,
> Offset,
> @@ -1385,7 +1420,7 @@ SDValue SelectionDAG::getTargetIndex(int
> ID.AddInteger(Offset);
> ID.AddInteger(TargetFlags);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) TargetIndexSDNode(Index, VT, Offset,
> @@ -1400,7 +1435,7 @@ SDValue SelectionDAG::getBasicBlock(Mach
> AddNodeIDNode(ID, ISD::BasicBlock, getVTList(MVT::Other), None);
> ID.AddPointer(MBB);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) BasicBlockSDNode(MBB);
> @@ -1613,7 +1648,7 @@ SDValue SelectionDAG::getVectorShuffle(E
> ID.AddInteger(MaskVec[i]);
>
> void* IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> // Allocate the mask array for the node out of the BumpPtrAllocator,
> since
> @@ -1655,7 +1690,7 @@ SDValue SelectionDAG::getConvertRndSat(E
> SDValue Ops[] = { Val, DTy, STy, Rnd, Sat };
> AddNodeIDNode(ID, ISD::CONVERT_RNDSAT, getVTList(VT), Ops);
> void* IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> CvtRndSatSDNode *N = new (NodeAllocator) CvtRndSatSDNode(VT,
> dl.getIROrder(),
> @@ -1671,7 +1706,7 @@ SDValue SelectionDAG::getRegister(unsign
> AddNodeIDNode(ID, ISD::Register, getVTList(VT), None);
> ID.AddInteger(RegNo);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) RegisterSDNode(RegNo, VT);
> @@ -1685,7 +1720,7 @@ SDValue SelectionDAG::getRegisterMask(co
> AddNodeIDNode(ID, ISD::RegisterMask, getVTList(MVT::Untyped), None);
> ID.AddPointer(RegMask);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) RegisterMaskSDNode(RegMask);
> @@ -1700,7 +1735,7 @@ SDValue SelectionDAG::getEHLabel(SDLoc d
> AddNodeIDNode(ID, ISD::EH_LABEL, getVTList(MVT::Other), Ops);
> ID.AddPointer(Label);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) EHLabelSDNode(dl.getIROrder(),
> @@ -1723,7 +1758,7 @@ SDValue SelectionDAG::getBlockAddress(co
> ID.AddInteger(Offset);
> ID.AddInteger(TargetFlags);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) BlockAddressSDNode(Opc, VT, BA, Offset,
> @@ -1742,7 +1777,7 @@ SDValue SelectionDAG::getSrcValue(const
> ID.AddPointer(V);
>
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) SrcValueSDNode(V);
> @@ -1758,7 +1793,7 @@ SDValue SelectionDAG::getMDNode(const MD
> ID.AddPointer(MD);
>
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) MDNodeSDNode(MD);
> @@ -1777,7 +1812,7 @@ SDValue SelectionDAG::getAddrSpaceCast(S
> ID.AddInteger(DestAS);
>
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) AddrSpaceCastSDNode(dl.getIROrder(),
> @@ -2717,7 +2752,7 @@ SDValue SelectionDAG::getNode(unsigned O
> FoldingSetNodeID ID;
> AddNodeIDNode(ID, Opcode, getVTList(VT), None);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, DL.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) SDNode(Opcode, DL.getIROrder(),
> @@ -3052,7 +3087,7 @@ SDValue SelectionDAG::getNode(unsigned O
> SDValue Ops[1] = { Operand };
> AddNodeIDNode(ID, Opcode, VTs, Ops);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, DL.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> N = new (NodeAllocator) UnarySDNode(Opcode, DL.getIROrder(),
> @@ -3664,7 +3699,7 @@ SDValue SelectionDAG::getNode(unsigned O
> AddNodeIDNode(ID, Opcode, VTs, Ops);
> AddNodeIDFlags(ID, Opcode, Flags);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, DL.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> N = GetBinarySDNode(Opcode, DL, VTs, N1, N2, Flags);
> @@ -3767,7 +3802,7 @@ SDValue SelectionDAG::getNode(unsigned O
> FoldingSetNodeID ID;
> AddNodeIDNode(ID, Opcode, VTs, Ops);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, DL.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> N = new (NodeAllocator) TernarySDNode(Opcode, DL.getIROrder(),
> @@ -4525,7 +4560,7 @@ SDValue SelectionDAG::getAtomic(unsigned
> AddNodeIDNode(ID, Opcode, VTList, Ops);
> ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
> void* IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP)) {
> cast<AtomicSDNode>(E)->refineAlignment(MMO);
> return SDValue(E, 0);
> }
> @@ -4730,7 +4765,7 @@ SelectionDAG::getMemIntrinsicNode(unsign
> AddNodeIDNode(ID, Opcode, VTList, Ops);
> ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP)) {
> cast<MemIntrinsicSDNode>(E)->refineAlignment(MMO);
> return SDValue(E, 0);
> }
> @@ -4852,7 +4887,7 @@ SelectionDAG::getLoad(ISD::MemIndexedMod
> MMO->isInvariant()));
> ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP)) {
> cast<LoadSDNode>(E)->refineAlignment(MMO);
> return SDValue(E, 0);
> }
> @@ -4960,7 +4995,7 @@ SDValue SelectionDAG::getStore(SDValue C
> MMO->isNonTemporal(),
> MMO->isInvariant()));
> ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP)) {
> cast<StoreSDNode>(E)->refineAlignment(MMO);
> return SDValue(E, 0);
> }
> @@ -5029,7 +5064,7 @@ SDValue SelectionDAG::getTruncStore(SDVa
> MMO->isNonTemporal(),
> MMO->isInvariant()));
> ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP)) {
> cast<StoreSDNode>(E)->refineAlignment(MMO);
> return SDValue(E, 0);
> }
> @@ -5055,7 +5090,7 @@ SelectionDAG::getIndexedStore(SDValue Or
> ID.AddInteger(ST->getRawSubclassData());
> ID.AddInteger(ST->getPointerInfo().getAddrSpace());
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> SDNode *N = new (NodeAllocator) StoreSDNode(Ops, dl.getIROrder(),
> @@ -5084,7 +5119,7 @@ SelectionDAG::getMaskedLoad(EVT VT, SDLo
> MMO->isInvariant()));
> ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP)) {
> cast<MaskedLoadSDNode>(E)->refineAlignment(MMO);
> return SDValue(E, 0);
> }
> @@ -5111,7 +5146,7 @@ SDValue SelectionDAG::getMaskedStore(SDV
> MMO->isNonTemporal(),
> MMO->isInvariant()));
> ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP)) {
> cast<MaskedStoreSDNode>(E)->refineAlignment(MMO);
> return SDValue(E, 0);
> }
> @@ -5137,7 +5172,7 @@ SelectionDAG::getMaskedGather(SDVTList V
> MMO->isInvariant()));
> ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP)) {
> cast<MaskedGatherSDNode>(E)->refineAlignment(MMO);
> return SDValue(E, 0);
> }
> @@ -5160,7 +5195,7 @@ SDValue SelectionDAG::getMaskedScatter(S
> MMO->isInvariant()));
> ID.AddInteger(MMO->getPointerInfo().getAddrSpace());
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
> + if (SDNode *E = FindNodeOrInsertPos(ID, dl.getDebugLoc(), IP)) {
> cast<MaskedScatterSDNode>(E)->refineAlignment(MMO);
> return SDValue(E, 0);
> }
> @@ -5236,7 +5271,7 @@ SDValue SelectionDAG::getNode(unsigned O
> AddNodeIDNode(ID, Opcode, VTs, Ops);
> void *IP = nullptr;
>
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, DL.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> N = new (NodeAllocator) SDNode(Opcode, DL.getIROrder(),
> DL.getDebugLoc(),
> @@ -5291,7 +5326,7 @@ SDValue SelectionDAG::getNode(unsigned O
> FoldingSetNodeID ID;
> AddNodeIDNode(ID, Opcode, VTList, Ops);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, DL.getDebugLoc(), IP))
> return SDValue(E, 0);
>
> if (NumOps == 1) {
> @@ -5717,7 +5752,7 @@ SDNode *SelectionDAG::MorphNodeTo(SDNode
> if (VTs.VTs[VTs.NumVTs-1] != MVT::Glue) {
> FoldingSetNodeID ID;
> AddNodeIDNode(ID, Opc, VTs, Ops);
> - if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *ON = FindNodeOrInsertPos(ID, N->getDebugLoc(), IP))
> return UpdadeSDLocOnMergedSDNode(ON, SDLoc(N));
> }
>
> @@ -5923,7 +5958,7 @@ SelectionDAG::getMachineNode(unsigned Op
> FoldingSetNodeID ID;
> AddNodeIDNode(ID, ~Opcode, VTs, OpsArray);
> IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
> + if (SDNode *E = FindNodeOrInsertPos(ID, DL.getDebugLoc(), IP)) {
> return cast<MachineSDNode>(UpdadeSDLocOnMergedSDNode(E, DL));
> }
> }
> @@ -5982,7 +6017,7 @@ SDNode *SelectionDAG::getNodeIfExists(un
> AddNodeIDNode(ID, Opcode, VTList, Ops);
> AddNodeIDFlags(ID, Opcode, Flags);
> void *IP = nullptr;
> - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
> + if (SDNode *E = FindNodeOrInsertPos(ID, DebugLoc(), IP))
> return E;
> }
> return nullptr;
>
> Modified: llvm/trunk/test/DebugInfo/AArch64/constant-dbgloc.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/AArch64/constant-dbgloc.ll?rev=237237&r1=237236&r2=237237&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/AArch64/constant-dbgloc.ll (original)
> +++ llvm/trunk/test/DebugInfo/AArch64/constant-dbgloc.ll Wed May 13
> 03:58:03 2015
> @@ -1,6 +1,4 @@
> ; RUN: llc -filetype=asm %s -o - | FileCheck %s
> -; XFAIL: *
> -; disabled until constant coalescing is resolved
>
> target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> target triple = "aarch64--linux-gnueabihf"
>
> Modified: llvm/trunk/test/DebugInfo/ARM/constant-dbgloc.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/ARM/constant-dbgloc.ll?rev=237237&r1=237236&r2=237237&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/ARM/constant-dbgloc.ll (original)
> +++ llvm/trunk/test/DebugInfo/ARM/constant-dbgloc.ll Wed May 13 03:58:03
> 2015
> @@ -1,6 +1,4 @@
> ; RUN: llc -filetype=asm %s -o - | FileCheck %s
> -; XFAIL: *
> -; disabled until constant coalescing is resolved
>
> target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> target triple = "armv7--linux-gnueabihf"
>
> Added: llvm/trunk/test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll?rev=237237&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll
> (added)
> +++ llvm/trunk/test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll
> Wed May 13 03:58:03 2015
> @@ -0,0 +1,54 @@
> +; RUN: llc -filetype=asm -asm-verbose=0 < %s | FileCheck %s
> +
> +; char ch;
> +; int b;
> +;
> +; void proc (void)
> +; {
> +; ch = 'A';
> +; b = 0; // <== this should have correct location
> +; }
> +
> +; CHECK: .loc 1 7 7
> +; CHECK: mov r{{[0-9]}}, #0
> +
> +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> +target triple = "armv7--linux-gnueabihf"
> +
> + at ch = common global i8 0, align 1
> + at b = common global i32 0, align 4
> +
> +; Function Attrs: nounwind
> +define void @proc() #0 {
> +entry:
> + store i8 65, i8* @ch, align 1, !dbg !17
> + store i32 0, i32* @b, align 4, !dbg !18
> + ret void, !dbg !19
> +}
> +
> +attributes #0 = { nounwind "less-precise-fpmad"="false"
> "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"
> "no-infs-fp-math"="false" "no-nans-fp-math"="false"
> "stack-protector-buffer-size"="8" "target-cpu"="cortex-a8"
> "target-features"="+neon,+vfp3" "unsafe-fp-math"="false"
> "use-soft-float"="false" }
> +
> +!llvm.dbg.cu = !{!0}
> +!llvm.module.flags = !{!12, !13, !14, !15}
> +!llvm.ident = !{!16}
> +
> +!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "",
> isOptimized: false, subprograms: !3)
> +!1 = !DIFile(filename: "test.c", directory: "/home/user/clang/build")
> +!2 = !{}
> +!3 = !{!4}
> +!4 = !DISubprogram(name: "proc", scope: !1, file: !1, line: 4, type: !5,
> isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped,
> isOptimized: false, function: void ()* @proc, variables: !2)
> +!5 = !DISubroutineType(types: !6)
> +!6 = !{null}
> +!7 = !{!8, !10}
> +!8 = !DIGlobalVariable(name: "ch", scope: !0, file: !1, line: 1, type:
> !9, isLocal: false, isDefinition: true, variable: i8* @ch)
> +!9 = !DIBasicType(name: "char", size: 8, align: 8, encoding:
> DW_ATE_unsigned_char)
> +!10 = !DIGlobalVariable(name: "b", scope: !0, file: !1, line: 2, type:
> !11, isLocal: false, isDefinition: true, variable: i32* @b)
> +!11 = !DIBasicType(name: "int", size: 32, align: 32, encoding:
> DW_ATE_signed)
> +!12 = !{i32 2, !"Dwarf Version", i32 4}
> +!13 = !{i32 2, !"Debug Info Version", i32 3}
> +!14 = !{i32 1, !"wchar_size", i32 4}
> +!15 = !{i32 1, !"min_enum_size", i32 4}
> +!16 = !{!"clang version 3.7.0 (http://llvm.org/git/clang.git
> 9b0abb9df531ef7928c8182120e1869affca17d5) (http://llvm.org/git/llvm.git
> b1e759524dd94f7ce1e24935daed8383927e96c1)"}
> +!17 = !DILocation(line: 6, column: 8, scope: !4)
> +!18 = !DILocation(line: 7, column: 7, scope: !4)
> +!19 = !DILocation(line: 8, column: 1, scope: !4)
>
> Added:
> llvm/trunk/test/DebugInfo/ARM/single-constant-use-preserves-dbgloc.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/ARM/single-constant-use-preserves-dbgloc.ll?rev=237237&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/ARM/single-constant-use-preserves-dbgloc.ll
> (added)
> +++ llvm/trunk/test/DebugInfo/ARM/single-constant-use-preserves-dbgloc.ll
> Wed May 13 03:58:03 2015
> @@ -0,0 +1,72 @@
> +; RUN: llc -filetype=asm -asm-verbose=0 < %s | FileCheck %s
> +
> +; int main()
> +; {
> +; int x = 0;
> +; if (x > 0)
> +; return x;
> +; x = -1; // <== this line should have correct debug location
> +; return -1;
> +; }
> +
> +; CHECK: .loc 1 6 7
> +; CHECK: mvn
> +
> +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> +target triple = "armv7--linux-gnueabihf"
> +
> +; Function Attrs: nounwind
> +define i32 @main() {
> +entry:
> + %retval = alloca i32, align 4
> + %x = alloca i32, align 4
> + store i32 0, i32* %retval
> + call void @llvm.dbg.declare(metadata i32* %x, metadata !10, metadata
> !11), !dbg !12
> + store i32 0, i32* %x, align 4, !dbg !12
> + %0 = load i32, i32* %x, align 4, !dbg !13
> + %cmp = icmp sgt i32 %0, 0, !dbg !15
> + br i1 %cmp, label %if.then, label %if.end, !dbg !16
> +
> +if.then: ; preds = %entry
> + %1 = load i32, i32* %x, align 4, !dbg !17
> + store i32 %1, i32* %retval, !dbg !18
> + br label %return, !dbg !18
> +
> +if.end: ; preds = %entry
> + store i32 -1, i32* %x, align 4, !dbg !19
> + store i32 -1, i32* %retval, !dbg !20
> + br label %return, !dbg !20
> +
> +return: ; preds = %if.end,
> %if.then
> + %2 = load i32, i32* %retval, !dbg !21
> + ret i32 %2, !dbg !21
> +}
> +
> +; Function Attrs: nounwind readnone
> +declare void @llvm.dbg.declare(metadata, metadata, metadata)
> +
> +!llvm.dbg.cu = !{!0}
> +!llvm.module.flags = !{!8, !9}
> +
> +!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "",
> isOptimized: false, subprograms: !3)
> +!1 = !DIFile(filename: "test.c", directory: "/home/user/clang/build")
> +!2 = !{}
> +!3 = !{!4}
> +!4 = !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !5,
> isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false,
> function: i32 ()* @main, variables: !2)
> +!5 = !DISubroutineType(types: !6)
> +!6 = !{!7}
> +!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding:
> DW_ATE_signed)
> +!8 = !{i32 2, !"Dwarf Version", i32 4}
> +!9 = !{i32 2, !"Debug Info Version", i32 3}
> +!10 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "x", scope: !4,
> file: !1, line: 3, type: !7)
> +!11 = !DIExpression()
> +!12 = !DILocation(line: 3, column: 9, scope: !4)
> +!13 = !DILocation(line: 4, column: 9, scope: !14)
> +!14 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 9)
> +!15 = !DILocation(line: 4, column: 11, scope: !14)
> +!16 = !DILocation(line: 4, column: 9, scope: !4)
> +!17 = !DILocation(line: 5, column: 13, scope: !14)
> +!18 = !DILocation(line: 5, column: 9, scope: !14)
> +!19 = !DILocation(line: 6, column: 7, scope: !4)
> +!20 = !DILocation(line: 7, column: 5, scope: !4)
> +!21 = !DILocation(line: 8, column: 1, scope: !4)
>
> Modified: llvm/trunk/test/DebugInfo/constant-sdnodes-have-dbg-location.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/constant-sdnodes-have-dbg-location.ll?rev=237237&r1=237236&r2=237237&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/constant-sdnodes-have-dbg-location.ll
> (original)
> +++ llvm/trunk/test/DebugInfo/constant-sdnodes-have-dbg-location.ll Wed
> May 13 03:58:03 2015
> @@ -1,7 +1,5 @@
> ; RUN: llc -debug < %s 2>&1 | FileCheck %s
> ; REQUIRES: asserts
> -; XFAIL: *
> -; disabled until constant coalescing is resolved
>
> ; CHECK: 0x{{[0-9,a-f]+}}: i32 = Constant<-1>test.c:4:5
>
>
> Added: llvm/trunk/test/DebugInfo/constantfp-sdnodes-have-dbg-location.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/constantfp-sdnodes-have-dbg-location.ll?rev=237237&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/constantfp-sdnodes-have-dbg-location.ll
> (added)
> +++ llvm/trunk/test/DebugInfo/constantfp-sdnodes-have-dbg-location.ll Wed
> May 13 03:58:03 2015
> @@ -0,0 +1,24 @@
> +; RUN: llc -debug < %s 2>&1 | FileCheck %s
> +; REQUIRES: asserts
> +
> +; CHECK: 0x{{[0-9,a-f]+}}: f64 = ConstantFP<1.500000e+00>test.c:3:5
> +
> +define double @f() {
> +entry:
> + ret double 1.500000e+00, !dbg !10
> +}
> +
> +!llvm.dbg.cu = !{!0}
> +!llvm.module.flags = !{!8, !9}
> +
> +!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "",
> isOptimized: false, subprograms: !3)
> +!1 = !DIFile(filename: "test.c", directory: "/home/user/clang-llvm/build")
> +!2 = !{}
> +!3 = !{!4}
> +!4 = !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !5,
> isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped,
> isOptimized: false, function: double ()* @f, variables: !2)
> +!5 = !DISubroutineType(types: !6)
> +!6 = !{!7}
> +!7 = !DIBasicType(name: "double", size: 64, align: 64, encoding:
> DW_ATE_float)
> +!8 = !{i32 2, !"Dwarf Version", i32 4}
> +!9 = !{i32 2, !"Debug Info Version", i32 3}
> +!10 = !DILocation(line: 3, column: 5, scope: !4)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150529/9a26e333/attachment.html>
More information about the llvm-commits
mailing list