[LLVMbugs] [Bug 8731] Clang generates load of struct value.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 6 09:11:44 PST 2010


Dan Gohman <gohman at apple.com> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |

--- Comment #2 from Dan Gohman <gohman at apple.com> 2010-12-06 11:11:44 CST ---
(In reply to comment #1)
> Dan's point is that first class values in general disable fastisel.

No it wasn't. The concern I expressed was about optimization. Aggregate loads
are never better than individual scalar loads, and can potentially be a lot
worse. Fast-isel's present limitations are another reason for preferring scalar
loads though.

> However,
> there is nothing that we can do about it in this case, as the ABI requires us
> to return them.

To return them yes, but there is an alternative to loading them:

  call void @_ZNSt4pairIPvxEC1ERKS0_RKx(%"struct.std::pair"* %retval, i8**
%__x.addr, i64* %__y.addr)
  %0 = getelementptr %"struct.std::pair"* %retval, 0, 0
  %1 = load i8** %0
  %2 = getelementptr %"struct.std::pair"* %retval, 0, 1
  %3 = load i64* %2
  %4 = insertvalue %"struct.std::pair" undef, %1, 0
  %5 = insertvalue %"struct.std::pair" %4, %3, 1
  ret %"struct.std::pair" %5

I'm contemplating whether to consider it a bug in clang for not doing this, or
to say that instcombine should expand aggregate loads into this form.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list