From 0086e8ade4a30f7fe358959d7da1768051e2ef8b Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Sat, 1 May 2021 21:01:06 -0700 Subject: [PATCH] [NFC] Use getParamByValType instead of pointee type To reduce dependence on pointee types for opaque pointers. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D101706 --- lib/Analysis/InlineCost.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp index 91ac849f97b..69cf28049b3 100644 --- a/lib/Analysis/InlineCost.cpp +++ b/lib/Analysis/InlineCost.cpp @@ -2444,7 +2444,7 @@ int llvm::getCallsiteCost(CallBase &Call, const DataLayout &DL) { // We approximate the number of loads and stores needed by dividing the // size of the byval type by the target's pointer size. PointerType *PTy = cast(Call.getArgOperand(I)->getType()); - unsigned TypeSize = DL.getTypeSizeInBits(PTy->getElementType()); + unsigned TypeSize = DL.getTypeSizeInBits(Call.getParamByValType(I)); unsigned AS = PTy->getAddressSpace(); unsigned PointerSize = DL.getPointerSizeInBits(AS); // Ceiling division.