// Relative-pointer support starts here.
if (auto *CI = dyn_cast<ConstantInt>(I)) {
- if (Offset == 0 && CI->getZExtValue() == 0) {
+ if (Offset == 0 && CI->isZero()) {
return I;
}
}
// For conditional branch lowering, we might try to do something silly like
// emit an G_ICMP to compare an existing G_ICMP i1 result with true. If so,
// just re-use the existing condition vreg.
- if (MRI->getType(CondLHS).getSizeInBits() == 1 && CI &&
- CI->getZExtValue() == 1 && CB.PredInfo.Pred == CmpInst::ICMP_EQ) {
+ if (MRI->getType(CondLHS).getSizeInBits() == 1 && CI && CI->isOne() &&
+ CB.PredInfo.Pred == CmpInst::ICMP_EQ) {
Cond = CondLHS;
} else {
Register CondRHS = getOrCreateVReg(*CB.CmpRHS);
Function *TheFn =
Intrinsic::getDeclaration(M, Intrinsic::vscale, {Scaling->getType()});
CallInst *CI = CreateCall(TheFn, {}, {}, Name);
- return cast<ConstantInt>(Scaling)->getSExtValue() == 1
- ? CI
- : CreateMul(CI, Scaling);
+ return cast<ConstantInt>(Scaling)->isOne() ? CI : CreateMul(CI, Scaling);
}
Value *IRBuilderBase::CreateElementCount(Type *DstType, ElementCount EC) {
ConstantInt *ElementConstant =
dyn_cast<ConstantInt>(Insert->getOperand(2));
// Check that the insertelement is inserting into element 0
- if (!ElementConstant || ElementConstant->getZExtValue() != 0)
+ if (!ElementConstant || !ElementConstant->isZero())
continue;
unsigned Opcode = OperandInstr->getOpcode();
case TargetOpcode::G_CONSTANT: {
bool IsZero = false;
if (I.getOperand(1).isCImm())
- IsZero = I.getOperand(1).getCImm()->getZExtValue() == 0;
+ IsZero = I.getOperand(1).getCImm()->isZero();
else if (I.getOperand(1).isImm())
IsZero = I.getOperand(1).getImm() == 0;
auto *PACValue = mdconst::extract_or_null<ConstantInt>(
SourceModule->getModuleFlag("sign-return-address"));
- if (PACValue && PACValue->getZExtValue() == 1) {
+ if (PACValue && PACValue->isOne()) {
// If "+pacbti" is used as an architecture extension,
// Tag_PAC_extension is emitted in
// ARMTargetStreamer::emitTargetAttributes().
auto *BTIValue = mdconst::extract_or_null<ConstantInt>(
SourceModule->getModuleFlag("branch-target-enforcement"));
- if (BTIValue && BTIValue->getZExtValue() == 1) {
+ if (BTIValue && BTIValue->isOne()) {
// If "+pacbti" is used as an architecture extension,
// Tag_BTI_extension is emitted in
// ARMTargetStreamer::emitTargetAttributes().
continue;
if (auto *T = dyn_cast<ConstantInt>(IncV))
- if (T->getZExtValue() == 1)
+ if (T->isOne())
return PN;
}
return nullptr;
if (MDNode *UnrollCountMD =
GetUnrollMetadata(LoopID, "llvm.loop.unroll.count")) {
if (mdconst::extract<ConstantInt>(UnrollCountMD->getOperand(1))
- ->getZExtValue() == 1)
+ ->isOne())
return true;
}
}
auto *LTOPostLinkMD =
cast_or_null<ConstantAsMetadata>(M.getModuleFlag("LTOPostLink"));
bool LTOPostLink =
- LTOPostLinkMD &&
- (cast<ConstantInt>(LTOPostLinkMD->getValue())->getZExtValue() != 0);
+ LTOPostLinkMD && !cast<ConstantInt>(LTOPostLinkMD->getValue())->isZero();
for (GlobalVariable &GV : M.globals()) {
Types.clear();
// Don't attempt VFE in that case.
auto *Val = mdconst::dyn_extract_or_null<ConstantInt>(
M.getModuleFlag("Virtual Function Elim"));
- if (!Val || Val->getZExtValue() == 0)
+ if (!Val || Val->isZero())
return;
ScanVTables(M);
return false;
auto *CI = mdconst::extract_or_null<ConstantInt>(
F->getParent()->getModuleFlag("CFI Canonical Jump Tables"));
- if (!CI || CI->getZExtValue() != 0)
+ if (!CI || !CI->isZero())
return true;
return F->hasFnAttribute("cfi-canonical-jump-table");
}
bool Endbr = false;
if (const auto *MD = mdconst::extract_or_null<ConstantInt>(
Dest->getParent()->getModuleFlag("cf-protection-branch")))
- Endbr = MD->getZExtValue() != 0;
+ Endbr = !MD->isZero();
if (Endbr)
AsmOS << (JumpTableArch == Triple::x86 ? "endbr32\n" : "endbr64\n");
AsmOS << "jmp ${" << ArgIndex << ":c}@plt\n";
auto Remark = [&](OptimizationRemark OR) {
return OR << "Replaced globalized variable with "
<< ore::NV("SharedMemory", AllocSize->getZExtValue())
- << ((AllocSize->getZExtValue() != 1) ? " bytes " : " byte ")
+ << (AllocSize->isOne() ? " byte " : " bytes ")
<< "of shared memory.";
};
A.emitRemark<OptimizationRemark>(CB, "OMP111", Remark);