From db598df4e81ed3527370fd5d649135d5a83ad867 Mon Sep 17 00:00:00 2001 From: TB Schardl Date: Sat, 21 Oct 2023 00:31:59 +0000 Subject: [PATCH] [AArch64] Modify read of threadpointer to be marked that it may load memory, rather than having unmodeled side effects. --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp | 2 ++ llvm/lib/Target/AArch64/AArch64InstrInfo.td | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp index 2e1fd1e8a758..cc6a6966b517 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp @@ -203,6 +203,8 @@ static void RemoveUnusedGlue(SDNode *N, SelectionDAG *DAG) { void ScheduleDAGSDNodes::ClusterNeighboringLoads(SDNode *Node) { SDValue Chain; unsigned NumOps = Node->getNumOperands(); + if (NumOps == 0) + return; if (Node->getOperand(NumOps-1).getValueType() == MVT::Other) Chain = Node->getOperand(NumOps-1); if (!Chain) diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td index beea680de1df..a15c99c71210 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td @@ -1513,7 +1513,7 @@ def : Pat<(AArch64mrs imm:$id), // The thread pointer (on Linux, at least, where this has been implemented) is // TPIDR_EL0. -let hasSideEffects = 1 in { +let mayLoad = 1 in { def MOVbaseTLS : Pseudo<(outs GPR64:$dst), (ins), [(set GPR64:$dst, AArch64threadpointer)]>, Sched<[WriteSys]>; }