[PATCH] D36844: [PGO] Fixed assertion due to mismatched memcpy size type.
Chad Rosier via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 18 09:31:33 PDT 2017
mcrosier added inline comments.
================
Comment at: lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp:368
// Fix the argument.
- dyn_cast<MemIntrinsic>(NewInst)->setLength(CaseSizeId);
+ MemIntrinsic * MemI = dyn_cast<MemIntrinsic>(NewInst);
+ IntegerType *SizeType = dyn_cast<IntegerType>(MemI->getLength()->getType());
----------------
I believe this can be just a cast, rather than a dyn_cast (we know the cloned instruction is a MemIntrinsic).
================
Comment at: lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp:370
+ IntegerType *SizeType = dyn_cast<IntegerType>(MemI->getLength()->getType());
+ assert(SizeType);
+ ConstantInt *CaseSizeId = ConstantInt::get(SizeType, SizeId);
----------------
You might consider adding a message within the assert:
assert(SizeType && "Expected an integer size type.");
https://reviews.llvm.org/D36844
More information about the llvm-commits
mailing list