[llvm] r240365 - AMDGPU: Use getAsInteger instead of atoi
Matt Arsenault
Matthew.Arsenault at amd.com
Mon Jun 22 19:05:56 PDT 2015
Author: arsenm
Date: Mon Jun 22 21:05:55 2015
New Revision: 240365
URL: http://llvm.org/viewvc/llvm-project?rev=240365&view=rev
Log:
AMDGPU: Use getAsInteger instead of atoi
Modified:
llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp?rev=240365&r1=240364&r2=240365&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp Mon Jun 22 21:05:55 2015
@@ -2211,8 +2211,9 @@ SDValue SITargetLowering::CreateLiveInRe
std::pair<unsigned, const TargetRegisterClass *>
SITargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
- const std::string &Constraint,
+ const std::string &Constraint_,
MVT VT) const {
+ StringRef Constraint(Constraint_);
if (Constraint == "r") {
switch(VT.SimpleTy) {
default: llvm_unreachable("Unhandled type for 'r' inline asm constraint");
@@ -2232,8 +2233,9 @@ SITargetLowering::getRegForInlineAsmCons
}
if (RC) {
- unsigned Idx = std::atoi(Constraint.substr(2).c_str());
- if (Idx < RC->getNumRegs())
+ uint32_t Idx;
+ bool Failed = Constraint.substr(2).getAsInteger(10, Idx);
+ if (!Failed && Idx < RC->getNumRegs())
return std::make_pair(RC->getRegister(Idx), RC);
}
}
More information about the llvm-commits
mailing list