aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-04-02 03:41:14 +0000
committerChris Lattner <sabre@nondot.org>2006-04-02 03:41:14 +0000
commite58a780166eb684164a0a95b999f29328d4e9b2b (patch)
tree43e6fb8473d183323b45fc4ef34c111b4e22a4a7 /lib/CodeGen
parent5348e393dff492b568c12f0bf5592509392b1407 (diff)
downloadexternal_llvm-e58a780166eb684164a0a95b999f29328d4e9b2b.zip
external_llvm-e58a780166eb684164a0a95b999f29328d4e9b2b.tar.gz
external_llvm-e58a780166eb684164a0a95b999f29328d4e9b2b.tar.bz2
Intrinsics that just load from memory can be treated like loads: they don't
have to serialize against each other. This allows us to schedule lvx's across each other, for example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 5a95ff0..2f79fe5 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1236,16 +1236,32 @@ static bool IntrinsicCannotAccessMemory(unsigned IntrinsicID) {
return false;
}
+// IntrinsicOnlyReadsMemory - Return true if the specified intrinsic doesn't
+// have any side-effects or if it only reads memory.
+static bool IntrinsicOnlyReadsMemory(unsigned IntrinsicID) {
+#define GET_SIDE_EFFECT_INFO
+#include "llvm/Intrinsics.gen"
+#undef GET_SIDE_EFFECT_INFO
+ return false;
+}
+
/// visitTargetIntrinsic - Lower a call of a target intrinsic to an INTRINSIC
/// node.
void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I,
unsigned Intrinsic) {
bool HasChain = !IntrinsicCannotAccessMemory(Intrinsic);
+ bool OnlyLoad = HasChain && IntrinsicOnlyReadsMemory(Intrinsic);
// Build the operand list.
std::vector<SDOperand> Ops;
- if (HasChain) // If this intrinsic has side-effects, chainify it.
- Ops.push_back(getRoot());
+ if (HasChain) { // If this intrinsic has side-effects, chainify it.
+ if (OnlyLoad) {
+ // We don't need to serialize loads against other loads.
+ Ops.push_back(DAG.getRoot());
+ } else {
+ Ops.push_back(getRoot());
+ }
+ }
// Add the intrinsic ID as an integer operand.
Ops.push_back(DAG.getConstant(Intrinsic, TLI.getPointerTy()));
@@ -1295,8 +1311,13 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I,
else
Result = DAG.getNode(ISD::INTRINSIC_VOID, VTs, Ops);
- if (HasChain)
- DAG.setRoot(Result.getValue(Result.Val->getNumValues()-1));
+ if (HasChain) {
+ SDOperand Chain = Result.getValue(Result.Val->getNumValues()-1);
+ if (OnlyLoad)
+ PendingLoads.push_back(Chain);
+ else
+ DAG.setRoot(Chain);
+ }
if (I.getType() != Type::VoidTy) {
if (const PackedType *PTy = dyn_cast<PackedType>(I.getType())) {
MVT::ValueType EVT = TLI.getValueType(PTy->getElementType());