[PATCH] D49442: [GlobalISel] Fix offsets to valueIsSplit

Aaron Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 11:48:53 PDT 2018


asmith created this revision.
asmith added a reviewer: llvm-commits.
Herald added subscribers: kristof.beyls, rovka.

This fix is for IRtranslator. Offsets passed to valueIsSplit() are stored by appending which ends up continuously appending offsets which were already resolved for the same type.

Here is a test case for our target were the two structs are passed in 4x 64b registers.

define i64 @param_two_struct([2 x i64] %t.coerce, [2 x i64] %s.coerce)  {
entry:

  %t.coerce.fca.0.extract = extractvalue [2 x i64] %t.coerce, 0
  %s.coerce.fca.1.extract = extractvalue [2 x i64] %s.coerce, 1
  %add = add nsw i64 %s.coerce.fca.1.extract, %t.coerce.fca.0.extract
  ret i64 %add


Repository:
  rL LLVM

https://reviews.llvm.org/D49442

Files:
  lib/CodeGen/GlobalISel/IRTranslator.cpp


Index: lib/CodeGen/GlobalISel/IRTranslator.cpp
===================================================================
--- lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -1586,7 +1586,9 @@
   for (auto &VArg : VRegArgs) {
     // If the argument is an unsplit scalar then don't use unpackRegs to avoid
     // creating redundant copies.
-    if (!valueIsSplit(*ArgIt, VMap.getOffsets(*ArgIt))) {
+    // If Offsets for a type is already stored, do not supply it.
+    auto *Offsets = VMap.getOffsets(*ArgIt);
+    if (!valueIsSplit(*ArgIt, Offsets->empty() ? Offsets : nullptr)) {
       auto &VRegs = *VMap.getVRegs(cast<Value>(*ArgIt));
       assert(VRegs.empty() && "VRegs already populated?");
       VRegs.push_back(VArg);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49442.155934.patch
Type: text/x-patch
Size: 765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180717/666837ff/attachment.bin>


More information about the llvm-commits mailing list