summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2012-09-10 08:43:23 +0000
committerNadav Rotem <nrotem@apple.com>2012-09-10 08:43:23 +0000
commitd753a952ca10346c9496911aaf25b6dbbe6f2d11 (patch)
tree3801fd9079bc5a50498d84e126700905770a3cab /llvm/lib/CodeGen
parent67192d41ee56be3b09be69d52b7e7cbbecdc79ab (diff)
downloadbcm5719-llvm-d753a952ca10346c9496911aaf25b6dbbe6f2d11.tar.gz
bcm5719-llvm-d753a952ca10346c9496911aaf25b6dbbe6f2d11.zip
Teach the DAGBuilder about lifetime markers which are generated from PHINodes.
llvm-svn: 163494
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 1eb251d0a68..483b051bdcf 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -5218,28 +5218,32 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
}
case Intrinsic::lifetime_start:
case Intrinsic::lifetime_end: {
+ bool IsStart = (Intrinsic == Intrinsic::lifetime_start);
// Stack coloring is not enabled in O0, discard region information.
- if (TM.getOptLevel() == CodeGenOpt::None) {
- if (Intrinsic == Intrinsic::lifetime_start)
- setValue(&I, DAG.getUNDEF(TLI.getPointerTy()));
- return 0;
- }
- SDValue Ops[2];
- AllocaInst *LifetimeObject =dyn_cast_or_null<AllocaInst>(
- GetUnderlyingObject(I.getArgOperand(1), TD));
- // Could not find an Alloca.
- if (!LifetimeObject)
+ if (TM.getOptLevel() == CodeGenOpt::None)
return 0;
- int FI = FuncInfo.StaticAllocaMap[LifetimeObject];
- Ops[0] = getRoot();
- Ops[1] = DAG.getFrameIndex(FI, TLI.getPointerTy(), true);
- bool IsStart = (Intrinsic == Intrinsic::lifetime_start);
- unsigned Opcode = (IsStart ? ISD::LIFETIME_START : ISD::LIFETIME_END);
+ SmallVector<Value *, 4> Allocas;
+ GetUnderlyingObjects(I.getArgOperand(1), Allocas, TD);
- Res = DAG.getNode(Opcode, dl, MVT::Other, Ops, 2);
- DAG.setRoot(Res);
- return 0;
+ for (SmallVector<Value*, 4>::iterator Object = Allocas.begin(),
+ E = Allocas.end(); Object != E; ++Object) {
+ AllocaInst *LifetimeObject = dyn_cast_or_null<AllocaInst>(*Object);
+
+ // Could not find an Alloca.
+ if (!LifetimeObject)
+ continue;
+
+ int FI = FuncInfo.StaticAllocaMap[LifetimeObject];
+
+ SDValue Ops[2];
+ Ops[0] = getRoot();
+ Ops[1] = DAG.getFrameIndex(FI, TLI.getPointerTy(), true);
+ unsigned Opcode = (IsStart ? ISD::LIFETIME_START : ISD::LIFETIME_END);
+
+ Res = DAG.getNode(Opcode, dl, MVT::Other, Ops, 2);
+ DAG.setRoot(Res);
+ }
}
case Intrinsic::invariant_start:
// Discard region information.
OpenPOWER on IntegriCloud