[PATCH] D35259: Complex Long Double classification In RegCall calling convention

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 19 11:49:50 PDT 2017


rnk added inline comments.


================
Comment at: lib/CodeGen/TargetInfo.cpp:3516
+  // calling convention is used.
   if (IsRegCall && FI.getReturnType()->getTypePtr()->isRecordType() &&
       !FI.getReturnType()->getTypePtr()->isUnionType()) {
----------------
This is incorrect. We should consult the CXXABI first, and then only do these regcall-specific things if it returns false. Consider adding this test case to find the bug:
```
struct NonTrivial {
  int x, y;
  ~NonTrivial();
};
NonTrivial __regcall f() { return NonTrivial(); }
```

This should not return in registers, but it does today.


================
Comment at: lib/CodeGen/TargetInfo.cpp:3526
     }
+  } else if (IsRegCall && FI.getReturnType()->getAs<ComplexType>()) {
+    const ComplexType *CT = FI.getReturnType()->getAs<ComplexType>();
----------------
This isn't necessarily a bug, but please always do C++ ABI classifications first so it's easy to spot the bug above.


https://reviews.llvm.org/D35259





More information about the cfe-commits mailing list