Merged from r221081 and r221102:
authorDaniel Sanders <daniel.sanders@imgtec.com>
Mon, 1 Dec 2014 16:26:48 +0000 (16:26 +0000)
committerDaniel Sanders <daniel.sanders@imgtec.com>
Mon, 1 Dec 2014 16:26:48 +0000 (16:26 +0000)
-------------------------------------------------------------------------------
Revert r221056 and others, "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC."

  r221056 "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC."
  r221058 "[mips] Fix unused variable warning introduced in r221056"
  r221059 "[mips] Move all ByVal handling into CCState and tablegen-erated code. NFC."
  r221061 "Renamed CCState members that appear to misspell 'Processed' as 'Proceed'. NFC."

It caused an undefined behavior in LLVM :: CodeGen/Mips/return-vector.ll.

-------------------------------------------------------------------------------
Re-commit r221056 and others with fix, "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC."

sret arguments can never originate from an f128 argument so we detect
sret arguments and push false into OriginalArgWasF128.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_35@223040 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsISelLowering.cpp

index e51f3cb608fccfc940b9af8a204d4ce5a591f226..3eefc0307508730e9c1669081fb94a8494a9bce5 100644 (file)
@@ -111,8 +111,17 @@ private:
     const MachineFunction &MF = getMachineFunction();
     for (unsigned i = 0; i < Ins.size(); ++i) {
       Function::const_arg_iterator FuncArg = MF.getFunction()->arg_begin();
-      std::advance(FuncArg, Ins[i].OrigArgIndex);
 
+      // SRet arguments cannot originate from f128 or {f128} returns so we just
+      // push false. We have to handle this specially since SRet arguments
+      // aren't mapped to an original argument.
+      if (Ins[i].Flags.isSRet()) {
+        OriginalArgWasF128.push_back(false);
+        continue;
+      }
+
+      assert(Ins[i].OrigArgIndex < MF.getFunction()->arg_size());
+      std::advance(FuncArg, Ins[i].OrigArgIndex);
       OriginalArgWasF128.push_back(
           originalTypeIsF128(FuncArg->getType(), nullptr));
     }