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

Camil Staps via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 12:09:41 PDT 2023


================
@@ -75,20 +75,23 @@ void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL, Type *Ty,
                      SmallVectorImpl<uint64_t> *FixedOffsets,
                      uint64_t StartingOffset);
 
-/// Variant of ComputeValueVTs that also produces the memory VTs.
+/// Variant of ComputeValueVTs that also produces the memory VTs and VT types.
----------------
camilstaps wrote:

@arsenm Thanks for the review! If I'm understanding the code correctly, EVTs do contain Type* references, but the EVT created for pointers in ComputeValueVTs is an integer type (`MVT::getIntegerVT(DL.getPointerSizeInBits(AS))`). I don't see a way to easily use the LLVMTy in EVTs for this purpose, but I may very well be mistaken.

It is possible to remove this logic from ComputeValueVTs and have a separate function to flatten the IR type. But there is quite a number of cases where this needs to be done, and the logic is identical to the one in ComputeValueVTs. If you think it preferable to do this, I would be happy to implement it, but I just want to make sure I'm understanding you correctly.

I would also be happy to implement a ComputeValueVTs variant for LLTs if you're going to need that for other things anyway. I don't really know what the GlobalISel transition is though and how involved this would be.

I'm assuming returning booleans (true for pointers) rather than Type*s from ComputeValueVTs does not really make things better for you? This was suggested by phoebewang in the linked issue.

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


More information about the llvm-commits mailing list