Skip, for now, callsites where use of sret argument is not dominated by callsite.
authorDevang Patel <dpatel@apple.com>
Wed, 5 Mar 2008 23:39:23 +0000 (23:39 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 5 Mar 2008 23:39:23 +0000 (23:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47980 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/StructRetPromotion.cpp

index 54a34e8803f16d9b98ab522922f2b9f600f545b4..5275edaa1693fd3c0aded33a1981cafd5994332a 100644 (file)
@@ -171,6 +171,10 @@ bool SRETPromotion::isSafeToUpdateAllCallers(Function *F) {
       // If FirstArg user is a GEP whose all users are not LoadInst then
       // this function F is not suitable for sret promotion.
       else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(ArgI)) {
+        // TODO : Use dom info and insert PHINodes to collect get results
+        // from multiple call sites for this GEP.
+        if (GEP->getParent() != Call->getParent())
+          return false;
         for (Value::use_iterator GEPI = GEP->use_begin(), GEPE = GEP->use_end();
              GEPI != GEPE; ++GEPI) 
           if (!isa<LoadInst>(GEPI))