diff options
| author | Owen Anderson <resistor@mac.com> | 2008-02-25 00:40:41 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2008-02-25 00:40:41 +0000 |
| commit | 05744bd8eb118afc01b9abf4fd40cd7fd68b1a74 (patch) | |
| tree | ab14394d9e8ef2f822a17cec1e7b5757aa7a3e11 /lib/Transforms | |
| parent | b59c7b2902878afea0d53fa05285b338fa5878ed (diff) | |
| download | external_llvm-05744bd8eb118afc01b9abf4fd40cd7fd68b1a74.zip external_llvm-05744bd8eb118afc01b9abf4fd40cd7fd68b1a74.tar.gz external_llvm-05744bd8eb118afc01b9abf4fd40cd7fd68b1a74.tar.bz2 | |
Fix an issue where GVN would try to use an instruction before its definition when performing return slot optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47541 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
| -rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 5ad9cbb..6506121 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -1099,6 +1099,13 @@ bool GVN::performReturnSlotOptzn(MemCpyInst* cpy, CallInst* C, !CS.paramHasAttr(1, ParamAttr::NoAlias | ParamAttr::StructRet)) return false; + // Since we're changing the parameter to the callsite, we need to make sure + // that what would be the new parameter dominates the callsite. + DominatorTree& DT = getAnalysis<DominatorTree>(); + if (Instruction* cpyDestInst = dyn_cast<Instruction>(cpyDest)) + if (!DT.dominates(cpyDestInst, C)) + return false; + // Check that something sneaky is not happening involving casting // return slot types around. if (CS.getArgument(0)->getType() != cpyDest->getType()) |
