[llvm] Correctly set pointer bit for aggregate values in SelectionDAGBuilder to fix CCIfPtr (PR #70554)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 19:17:56 PST 2023


================
@@ -1000,15 +1001,21 @@ bool FastISel::lowerCallTo(CallLoweringInfo &CLI) {
   if (!CanLowerReturn)
     return false;
 
-  for (unsigned I = 0, E = RetTys.size(); I != E; ++I) {
-    EVT VT = RetTys[I];
+  for (unsigned I = 0, E = RetVTs.size(); I != E; ++I) {
+    EVT VT = RetVTs[I];
+    Type *Ty = RetTys[I];
     MVT RegisterVT = TLI.getRegisterType(CLI.RetTy->getContext(), VT);
     unsigned NumRegs = TLI.getNumRegisters(CLI.RetTy->getContext(), VT);
     for (unsigned i = 0; i != NumRegs; ++i) {
       ISD::InputArg MyFlags;
       MyFlags.VT = RegisterVT;
       MyFlags.ArgVT = VT;
       MyFlags.Used = CLI.IsReturnValueUsed;
+      if (Ty->isPointerTy()) {
+        MyFlags.Flags.setPointer();
+        MyFlags.Flags.setPointerAddrSpace(
+            cast<PointerType>(Ty)->getAddressSpace());
----------------
arsenm wrote:

dyn_cast to PointerType instead of isPointerTy+cast (though I guess this is already pre-existing in the other cases)

https://github.com/llvm/llvm-project/pull/70554


More information about the llvm-commits mailing list