@@ -133,15 +133,15 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) {
133133 // wouldn't be constant), and this must be a noop.
134134 if (!isModSet (AA->getModRefInfoMask (MI->getDest ()))) {
135135 // Set the size of the copy to 0, it will be deleted on the next iteration.
136- MI->setLength (Constant::getNullValue (MI-> getLength ()-> getType ()) );
136+ MI->setLength (( uint64_t ) 0 );
137137 return MI;
138138 }
139139
140140 // If the source is provably undef, the memcpy/memmove doesn't do anything
141141 // (unless the transfer is volatile).
142142 if (hasUndefSource (MI) && !MI->isVolatile ()) {
143143 // Set the size of the copy to 0, it will be deleted on the next iteration.
144- MI->setLength (Constant::getNullValue (MI-> getLength ()-> getType ()) );
144+ MI->setLength (( uint64_t ) 0 );
145145 return MI;
146146 }
147147
@@ -211,7 +211,7 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) {
211211 }
212212
213213 // Set the size of the copy to 0, it will be deleted on the next iteration.
214- MI->setLength (Constant::getNullValue (MemOpLength-> getType ()) );
214+ MI->setLength (( uint64_t ) 0 );
215215 return MI;
216216}
217217
@@ -229,7 +229,7 @@ Instruction *InstCombinerImpl::SimplifyAnyMemSet(AnyMemSetInst *MI) {
229229 // wouldn't be constant), and this must be a noop.
230230 if (!isModSet (AA->getModRefInfoMask (MI->getDest ()))) {
231231 // Set the size of the copy to 0, it will be deleted on the next iteration.
232- MI->setLength (Constant::getNullValue (MI-> getLength ()-> getType ()) );
232+ MI->setLength (( uint64_t ) 0 );
233233 return MI;
234234 }
235235
@@ -238,7 +238,7 @@ Instruction *InstCombinerImpl::SimplifyAnyMemSet(AnyMemSetInst *MI) {
238238 // value. Change to PoisonValue once #52930 is resolved.
239239 if (isa<UndefValue>(MI->getValue ())) {
240240 // Set the size of the copy to 0, it will be deleted on the next iteration.
241- MI->setLength (Constant::getNullValue (MI-> getLength ()-> getType ()) );
241+ MI->setLength (( uint64_t ) 0 );
242242 return MI;
243243 }
244244
@@ -277,7 +277,7 @@ Instruction *InstCombinerImpl::SimplifyAnyMemSet(AnyMemSetInst *MI) {
277277 S->setOrdering (AtomicOrdering::Unordered);
278278
279279 // Set the size of the copy to 0, it will be deleted on the next iteration.
280- MI->setLength (Constant::getNullValue (LenC-> getType ()) );
280+ MI->setLength (( uint64_t ) 0 );
281281 return MI;
282282 }
283283
@@ -1751,9 +1751,9 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
17511751 // Intrinsics cannot occur in an invoke or a callbr, so handle them here
17521752 // instead of in visitCallBase.
17531753 if (auto *MI = dyn_cast<AnyMemIntrinsic>(II)) {
1754- if (ConstantInt * NumBytes = dyn_cast<ConstantInt>( MI->getLength () )) {
1754+ if (auto NumBytes = MI->getLengthInBytes ( )) {
17551755 // memmove/cpy/set of zero bytes is a noop.
1756- if (NumBytes->isNullValue ())
1756+ if (NumBytes->isZero ())
17571757 return eraseInstFromFunction (CI);
17581758
17591759 // For atomic unordered mem intrinsics if len is not a positive or
0 commit comments