Skip to content

Commit adc6b43

Browse files
authored
[llvm][NFC] Autoupdater AMD intrinsic detection (#73331)
Check atomic prefix before looking for atomic instructions
1 parent 9553e15 commit adc6b43

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -949,11 +949,14 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
949949
return true;
950950
}
951951

952-
if (Name.starts_with("atomic.inc") || Name.starts_with("atomic.dec")) {
953-
// This was replaced with atomicrmw uinc_wrap and udec_wrap, so there's no
954-
// new declaration.
955-
NewFn = nullptr;
956-
return true;
952+
if (Name.consume_front("atomic.")) {
953+
if (Name.starts_with("inc") || Name.starts_with("dec")) {
954+
// These were replaced with atomicrmw uinc_wrap and udec_wrap, so
955+
// there's no new declaration.
956+
NewFn = nullptr;
957+
return true;
958+
}
959+
break; // No other 'amdgcn.atomic.*'
957960
}
958961

959962
if (Name.starts_with("ldexp.")) {
@@ -963,6 +966,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
963966
{F->getReturnType(), F->getArg(1)->getType()});
964967
return true;
965968
}
969+
break; // No other 'amdgcn.*'
966970
}
967971

968972
break;

0 commit comments

Comments
 (0)