@@ -1353,12 +1353,12 @@ static bool upgradeIntrinsicFunction1(Function *F, Function *&NewFn,
13531353 // nvvm.{min,max}.{i,ii,ui,ull}
13541354 Expand = Name == " s" || Name == " i" || Name == " ll" || Name == " us" ||
13551355 Name == " ui" || Name == " ull" ;
1356- else if (Name.consume_front (" atomic.load.add. " ))
1357- // nvvm.atomic.load.add.{f32.p ,f64.p}
1358- Expand = Name. starts_with ( " f32.p " ) || Name. starts_with ( " f64.p " );
1359- else if (Name. consume_front ( " atomic.load. " ) && Name.consume_back ( " .32 " ))
1360- // nvvm.atomic.load.{inc,dec}.32
1361- Expand = Name == " inc" || Name == " dec" ;
1356+ else if (Name.consume_front (" atomic.load." ))
1357+ // nvvm.atomic.load.add.{f32,f64}.p
1358+ // nvvm.atomic.load.{inc,dec}.32.p
1359+ Expand = Name.starts_with ( " add.f32.p " ) ||
1360+ Name. starts_with ( " add.f64.p " ) ||
1361+ Name. starts_with ( " inc.32.p " ) || Name. starts_with ( " dec.32.p " ) ;
13621362 else if (Name.consume_front (" bitcast." ))
13631363 // nvvm.bitcast.{f2i,i2f,ll2d,d2ll}
13641364 Expand =
@@ -2383,10 +2383,12 @@ static Value *upgradeNVVMIntrinsicCall(StringRef Name, CallBase *CI,
23832383 Value *Val = CI->getArgOperand (1 );
23842384 Rep = Builder.CreateAtomicRMW (AtomicRMWInst::FAdd, Ptr, Val, MaybeAlign (),
23852385 AtomicOrdering::SequentiallyConsistent);
2386- } else if (Name.consume_front (" atomic.load." ) && Name.consume_back (" .32" )) {
2386+ } else if (Name.starts_with (" atomic.load.inc.32.p" ) ||
2387+ Name.starts_with (" atomic.load.dec.32.p" )) {
23872388 Value *Ptr = CI->getArgOperand (0 );
23882389 Value *Val = CI->getArgOperand (1 );
2389- auto Op = Name == " inc" ? AtomicRMWInst::UIncWrap : AtomicRMWInst::UDecWrap;
2390+ auto Op = Name.starts_with (" atomic.load.inc" ) ? AtomicRMWInst::UIncWrap
2391+ : AtomicRMWInst::UDecWrap;
23902392 Rep = Builder.CreateAtomicRMW (Op, Ptr, Val, MaybeAlign (),
23912393 AtomicOrdering::SequentiallyConsistent);
23922394 } else if (Name.consume_front (" max." ) &&
0 commit comments