@@ -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
@@ -279,7 +279,7 @@ Instruction *InstCombinerImpl::SimplifyAnyMemSet(AnyMemSetInst *MI) {
279279 S->setOrdering (AtomicOrdering::Unordered);
280280
281281 // Set the size of the copy to 0, it will be deleted on the next iteration.
282- MI->setLength (Constant::getNullValue (LenC-> getType ()) );
282+ MI->setLength (( uint64_t ) 0 );
283283 return MI;
284284 }
285285
@@ -1753,9 +1753,9 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
17531753 // Intrinsics cannot occur in an invoke or a callbr, so handle them here
17541754 // instead of in visitCallBase.
17551755 if (auto *MI = dyn_cast<AnyMemIntrinsic>(II)) {
1756- if (ConstantInt * NumBytes = dyn_cast<ConstantInt>( MI->getLength () )) {
1756+ if (auto NumBytes = MI->getLengthInBytes ( )) {
17571757 // memmove/cpy/set of zero bytes is a noop.
1758- if (NumBytes->isNullValue ())
1758+ if (NumBytes->isZero ())
17591759 return eraseInstFromFunction (CI);
17601760
17611761 // For atomic unordered mem intrinsics if len is not a positive or
0 commit comments