summaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/Local.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-12-08 16:22:26 +0000
committerChris Lattner <sabre@nondot.org>2004-12-08 16:22:26 +0000
commitfe781654a365946652dbebaed89194c793b74246 (patch)
treeaf693e49cf6734418ba892c6d6d1122e7e24256d /lib/Analysis/DataStructure/Local.cpp
parentc4b09ba2884c5df683c30cedf1736c92700ac3e5 (diff)
downloadllvm-fe781654a365946652dbebaed89194c793b74246.tar.gz
llvm-fe781654a365946652dbebaed89194c793b74246.tar.bz2
llvm-fe781654a365946652dbebaed89194c793b74246.tar.xz
Work correctly with ICC, Patch contributed by Bjørn Wennberg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Local.cpp')
-rw-r--r--lib/Analysis/DataStructure/Local.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp
index cbdbb12d65..1b30d1e9d3 100644
--- a/lib/Analysis/DataStructure/Local.cpp
+++ b/lib/Analysis/DataStructure/Local.cpp
@@ -629,9 +629,12 @@ void GraphBuilder::visitCallSite(CallSite CS) {
// If this is freopen, merge the file descriptor passed in with the
// result.
- if (F->getName() == "freopen")
- Result.mergeWith(getValueDest(**--CS.arg_end()));
-
+ if (F->getName() == "freopen") {
+ // ICC doesn't handle getting the iterator, decrementing and
+ // dereferencing it in one operation without error. Do it in 2 steps
+ CallSite::arg_iterator compit = CS.arg_end();
+ Result.mergeWith(getValueDest(**--compit));
+ }
return;
} else if (F->getName() == "fclose" && CS.arg_end()-CS.arg_begin() ==1){
// fclose reads and deallocates the memory in an unknown way for the
@@ -665,7 +668,8 @@ void GraphBuilder::visitCallSite(CallSite CS) {
(F->getName() == "fwrite" || F->getName() == "fread")) {
// fread writes the first operand, fwrite reads it. They both
// read/write the FILE descriptor, and merges the FILE type.
- DSNodeHandle H = getValueDest(**--CS.arg_end());
+ CallSite::arg_iterator compit = CS.arg_end();
+ DSNodeHandle H = getValueDest(**--compit);
if (DSNode *N = H.getNode()) {
N->setReadMarker()->setModifiedMarker();
const Type *ArgTy = F->getFunctionType()->getParamType(3);
@@ -706,10 +710,12 @@ void GraphBuilder::visitCallSite(CallSite CS) {
F->getName() == "_IO_putc") {
// These functions read and write the memory for the file descriptor,
// which is passes as the last argument.
- DSNodeHandle H = getValueDest(**--CS.arg_end());
+ CallSite::arg_iterator compit = CS.arg_end();
+ DSNodeHandle H = getValueDest(**--compit);
if (DSNode *N = H.getNode()) {
N->setReadMarker()->setModifiedMarker();
- const Type *ArgTy = *--F->getFunctionType()->param_end();
+ FunctionType::param_iterator compit2 = F->getFunctionType()->param_end();
+ const Type *ArgTy = *--compit2;
if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy))
N->mergeTypeInfo(PTy->getElementType(), H.getOffset());
}
@@ -727,7 +733,8 @@ void GraphBuilder::visitCallSite(CallSite CS) {
// and read/write all other arguments.
DSNodeHandle H = getValueDest(**CS.arg_begin());
if (DSNode *N = H.getNode()) {
- const Type *ArgTy = *--F->getFunctionType()->param_end();
+ FunctionType::param_iterator compit2 = F->getFunctionType()->param_end();
+ const Type *ArgTy = *--compit2;
if (const PointerType *PTy = dyn_cast<PointerType>(ArgTy))
N->mergeTypeInfo(PTy->getElementType(), H.getOffset());
}
@@ -897,7 +904,8 @@ void GraphBuilder::visitCallSite(CallSite CS) {
return;
} else if (F->getName() == "modf" && CS.arg_end()-CS.arg_begin() == 2) {
// This writes its second argument, and forces it to double.
- DSNodeHandle H = getValueDest(**--CS.arg_end());
+ CallSite::arg_iterator compit = CS.arg_end();
+ DSNodeHandle H = getValueDest(**--compit);
if (DSNode *N = H.getNode()) {
N->setModifiedMarker();
N->mergeTypeInfo(Type::DoubleTy, H.getOffset());