llvm.org GIT mirror llvm / c3f211d
Fix parameter name comments using clang-tidy. NFC. This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch: $ git clone https://github.com/llvm/llvm-project.git $ cd llvm-project $ mkdir build $ cd build $ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm $ ninja $ parallel clang-tidy -checks='-*,bugprone-argument-comment' \ -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \ ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h} git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366177 91177308-0d34-0410-b5e6-96231b3b80d8 Rui Ueyama 3 months ago
37 changed file(s) with 68 addition(s) and 68 deletion(s). Raw diff Collapse all Expand all
12771277 case Intrinsic::experimental_vector_reduce_fmin:
12781278 return ConcreteTTI->getMinMaxReductionCost(
12791279 Tys[0], CmpInst::makeCmpResultType(Tys[0]), /*IsPairwiseForm=*/false,
1280 /*IsSigned=*/true);
1280 /*IsUnsigned=*/true);
12811281 case Intrinsic::experimental_vector_reduce_umax:
12821282 case Intrinsic::experimental_vector_reduce_umin:
12831283 return ConcreteTTI->getMinMaxReductionCost(
12841284 Tys[0], CmpInst::makeCmpResultType(Tys[0]), /*IsPairwiseForm=*/false,
1285 /*IsSigned=*/false);
1285 /*IsUnsigned=*/false);
12861286 case Intrinsic::sadd_sat:
12871287 case Intrinsic::ssub_sat: {
12881288 Type *CondTy = Type::getInt1Ty(RetTy->getContext());
2626 char EdgeBundles::ID = 0;
2727
2828 INITIALIZE_PASS(EdgeBundles, "edge-bundles", "Bundle Machine CFG Edges",
29 /* cfg = */true, /* analysis = */ true)
29 /* cfg = */true, /* is_analysis = */ true)
3030
3131 char &llvm::EdgeBundlesID = EdgeBundles::ID;
3232
997997 while (!KilledRegs.empty()) {
998998 unsigned Reg = KilledRegs.pop_back_val();
999999 for (instr_iterator I = instr_end(), E = instr_begin(); I != E;) {
1000 if (!(--I)->addRegisterKilled(Reg, TRI, /* addIfNotFound= */ false))
1000 if (!(--I)->addRegisterKilled(Reg, TRI, /* AddIfNotFound= */ false))
10011001 continue;
10021002 if (TargetRegisterInfo::isVirtualRegister(Reg))
10031003 LV->getVarInfo(Reg).Kills.push_back(&*I);
30393039
30403040 if (BF.OptimizeFunction(MF, TII, MF.getSubtarget().getRegisterInfo(),
30413041 getAnalysisIfAvailable(), MLI,
3042 /*AfterBlockPlacement=*/true)) {
3042 /*AfterPlacement=*/true)) {
30433043 // Redo the layout if tail merging creates/removes/moves blocks.
30443044 BlockToChain.clear();
30453045 ComputedEdges.clear();
9191 Alignment = clampStackAlignment(!StackRealignable, Alignment, StackAlignment);
9292 Objects.insert(Objects.begin(),
9393 StackObject(Size, Alignment, SPOffset, IsImmutable,
94 /*isSpillSlot=*/false, /*Alloca=*/nullptr,
94 /*IsSpillSlot=*/false, /*Alloca=*/nullptr,
9595 IsAliased));
9696 return -++NumFixedObjects;
9797 }
164164 !F.hasFnAttribute("no-realign-stack");
165165 FrameInfo = new (Allocator) MachineFrameInfo(
166166 getFnStackAlignment(STI, F), /*StackRealignable=*/CanRealignSP,
167 /*ForceRealign=*/CanRealignSP &&
167 /*ForcedRealign=*/CanRealignSP &&
168168 F.hasFnAttribute(Attribute::StackAlignment));
169169
170170 if (F.hasFnAttribute(Attribute::StackAlignment))
780780 unsigned Reg = getRegForValue(Val);
781781 if (!Reg)
782782 return false;
783 Ops.push_back(MachineOperand::CreateReg(Reg, /*IsDef=*/false));
783 Ops.push_back(MachineOperand::CreateReg(Reg, /*isDef=*/false));
784784 }
785785 }
786786 return true;
829829 const MCPhysReg *ScratchRegs = TLI.getScratchRegisters(CC);
830830 for (unsigned i = 0; ScratchRegs[i]; ++i)
831831 Ops.push_back(MachineOperand::CreateReg(
832 ScratchRegs[i], /*IsDef=*/true, /*IsImp=*/true, /*IsKill=*/false,
833 /*IsDead=*/false, /*IsUndef=*/false, /*IsEarlyClobber=*/true));
832 ScratchRegs[i], /*isDef=*/true, /*isImp=*/true, /*isKill=*/false,
833 /*isDead=*/false, /*isUndef=*/false, /*isEarlyClobber=*/true));
834834
835835 // Issue CALLSEQ_START
836836 unsigned AdjStackDown = TII.getCallFrameSetupOpcode();
940940 assert(CLI.NumResultRegs == 0 && "Unexpected result register.");
941941 CLI.ResultReg = createResultReg(TLI.getRegClassFor(MVT::i64));
942942 CLI.NumResultRegs = 1;
943 Ops.push_back(MachineOperand::CreateReg(CLI.ResultReg, /*IsDef=*/true));
943 Ops.push_back(MachineOperand::CreateReg(CLI.ResultReg, /*isDef=*/true));
944944 }
945945
946946 // Add the and constants.
989989 unsigned Reg = getRegForValue(I->getArgOperand(i));
990990 if (!Reg)
991991 return false;
992 Ops.push_back(MachineOperand::CreateReg(Reg, /*IsDef=*/false));
992 Ops.push_back(MachineOperand::CreateReg(Reg, /*isDef=*/false));
993993 }
994994 }
995995
996996 // Push the arguments from the call instruction.
997997 for (auto Reg : CLI.OutRegs)
998 Ops.push_back(MachineOperand::CreateReg(Reg, /*IsDef=*/false));
998 Ops.push_back(MachineOperand::CreateReg(Reg, /*isDef=*/false));
999999
10001000 // Push live variables for the stack map.
10011001 if (!addStackMapLiveVars(Ops, I, NumMetaOpers + NumArgs))
10091009 const MCPhysReg *ScratchRegs = TLI.getScratchRegisters(CC);
10101010 for (unsigned i = 0; ScratchRegs[i]; ++i)
10111011 Ops.push_back(MachineOperand::CreateReg(
1012 ScratchRegs[i], /*IsDef=*/true, /*IsImp=*/true, /*IsKill=*/false,
1013 /*IsDead=*/false, /*IsUndef=*/false, /*IsEarlyClobber=*/true));
1012 ScratchRegs[i], /*isDef=*/true, /*isImp=*/true, /*isKill=*/false,
1013 /*isDead=*/false, /*isUndef=*/false, /*isEarlyClobber=*/true));
10141014
10151015 // Add implicit defs (return values).
10161016 for (auto Reg : CLI.InRegs)
1017 Ops.push_back(MachineOperand::CreateReg(Reg, /*IsDef=*/true,
1018 /*IsImpl=*/true));
1017 Ops.push_back(MachineOperand::CreateReg(Reg, /*isDef=*/true,
1018 /*isImp=*/true));
10191019
10201020 // Insert the patchpoint instruction before the call generated by the target.
10211021 MachineInstrBuilder MIB = BuildMI(*FuncInfo.MBB, CLI.Call, DbgLoc,
10431043 return true; // don't do anything to this instruction.
10441044 SmallVector Ops;
10451045 Ops.push_back(MachineOperand::CreateReg(getRegForValue(I->getArgOperand(0)),
1046 /*IsDef=*/false));
1046 /*isDef=*/false));
10471047 Ops.push_back(MachineOperand::CreateReg(getRegForValue(I->getArgOperand(1)),
1048 /*IsDef=*/false));
1048 /*isDef=*/false));
10491049 MachineInstrBuilder MIB =
10501050 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
10511051 TII.get(TargetOpcode::PATCHABLE_EVENT_CALL));
10621062 return true; // don't do anything to this instruction.
10631063 SmallVector Ops;
10641064 Ops.push_back(MachineOperand::CreateReg(getRegForValue(I->getArgOperand(0)),
1065 /*IsDef=*/false));
1065 /*isDef=*/false));
10661066 Ops.push_back(MachineOperand::CreateReg(getRegForValue(I->getArgOperand(1)),
1067 /*IsDef=*/false));
1067 /*isDef=*/false));
10681068 Ops.push_back(MachineOperand::CreateReg(getRegForValue(I->getArgOperand(2)),
1069 /*IsDef=*/false));
1069 /*isDef=*/false));
10701070 MachineInstrBuilder MIB =
10711071 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
10721072 TII.get(TargetOpcode::PATCHABLE_TYPED_EVENT_CALL));
150150 auto Iter = CatchObjects.find(AI);
151151 if (Iter != CatchObjects.end() && TLI->needsFixedCatchObjects()) {
152152 FrameIndex = MF->getFrameInfo().CreateFixedObject(
153 TySize, 0, /*Immutable=*/false, /*isAliased=*/true);
153 TySize, 0, /*IsImmutable=*/false, /*isAliased=*/true);
154154 MF->getFrameInfo().setObjectAlignment(FrameIndex, Align);
155155 } else {
156156 FrameIndex =
14751475 Flags.setZExt();
14761476
14771477 for (unsigned i = 0; i < NumParts; ++i)
1478 Outs.push_back(ISD::OutputArg(Flags, PartVT, VT, /*isFixed=*/true, 0, 0));
1478 Outs.push_back(ISD::OutputArg(Flags, PartVT, VT, /*isfixed=*/true, 0, 0));
14791479 }
14801480 }
14811481
12231223 if (!Load)
12241224 Load = new LoadInst(V->getType(), SpillSlot,
12251225 Twine(V->getName(), ".wineh.reload"),
1226 /*Volatile=*/false, IncomingBlock->getTerminator());
1226 /*isVolatile=*/false, IncomingBlock->getTerminator());
12271227
12281228 U.set(Load);
12291229 } else {
12301230 // Reload right before the old use.
12311231 auto *Load = new LoadInst(V->getType(), SpillSlot,
12321232 Twine(V->getName(), ".wineh.reload"),
1233 /*Volatile=*/false, UsingInst);
1233 /*isVolatile=*/false, UsingInst);
12341234 U.set(Load);
12351235 }
12361236 }
309309 OS << "value";
310310
311311 OS << " '";
312 V->printAsOperand(OS, /*PrintTy=*/false, M);
312 V->printAsOperand(OS, /*PrintType=*/false, M);
313313 OS << "'\n";
314314 }
315315
2121
2222 // (Over-)estimate the required number of bits.
2323 unsigned NumBits = ((Str.size() * 64) / 19) + 2;
24 APInt Tmp(NumBits, Str, /*Radix=*/10);
24 APInt Tmp(NumBits, Str, /*radix=*/10);
2525 if (Str[0] == '-') {
2626 unsigned MinBits = Tmp.getMinSignedBits();
2727 if (MinBits > 0 && MinBits < NumBits)
2828 Tmp = Tmp.trunc(MinBits);
29 *this = APSInt(Tmp, /*IsUnsigned=*/false);
29 *this = APSInt(Tmp, /*isUnsigned=*/false);
3030 return;
3131 }
3232 unsigned ActiveBits = Tmp.getActiveBits();
3333 if (ActiveBits > 0 && ActiveBits < NumBits)
3434 Tmp = Tmp.trunc(ActiveBits);
35 *this = APSInt(Tmp, /*IsUnsigned=*/true);
35 *this = APSInt(Tmp, /*isUnsigned=*/true);
3636 }
3737
3838 void APSInt::Profile(FoldingSetNodeID& ID) const {
1616
1717 LLT::LLT(MVT VT) {
1818 if (VT.isVector()) {
19 init(/*isPointer=*/false, VT.getVectorNumElements() > 1,
19 init(/*IsPointer=*/false, VT.getVectorNumElements() > 1,
2020 VT.getVectorNumElements(), VT.getVectorElementType().getSizeInBits(),
2121 /*AddressSpace=*/0);
2222 } else if (VT.isValid()) {
2323 // Aggregates are no different from real scalars as far as GlobalISel is
2424 // concerned.
2525 assert(VT.getSizeInBits() != 0 && "invalid zero-sized type");
26 init(/*isPointer=*/false, /*isVector=*/false, /*NumElements=*/0,
26 init(/*IsPointer=*/false, /*IsVector=*/false, /*NumElements=*/0,
2727 VT.getSizeInBits(), /*AddressSpace=*/0);
2828 } else {
2929 IsPointer = false;
611611 // destructing raw_ostream objects which may have errors.
612612 if (has_error())
613613 report_fatal_error("IO failure on output stream: " + error().message(),
614 /*GenCrashDiag=*/false);
614 /*gen_crash_diag=*/false);
615615 }
616616
617617 #if defined(_WIN32)
23642364 AArch64::sub_32);
23652365
23662366 if ((BW < 32) && !IsBitTest)
2367 SrcReg = emitIntExt(VT, SrcReg, MVT::i32, /*IsZExt=*/true);
2367 SrcReg = emitIntExt(VT, SrcReg, MVT::i32, /*isZExt=*/true);
23682368
23692369 // Emit the combined compare and branch instruction.
23702370 SrcReg = constrainOperandRegClass(II, SrcReg, II.getNumDefs());
42714271 const TargetRegisterClass *RC =
42724272 (RetVT == MVT::i64) ? &AArch64::GPR64RegClass : &AArch64::GPR32RegClass;
42734273 if (NeedTrunc) {
4274 Op0Reg = emitIntExt(RetVT, Op0Reg, MVT::i32, /*IsZExt=*/false);
4274 Op0Reg = emitIntExt(RetVT, Op0Reg, MVT::i32, /*isZExt=*/false);
42754275 Op1Reg = emitAnd_ri(MVT::i32, Op1Reg, Op1IsKill, Mask);
42764276 Op0IsKill = Op1IsKill = true;
42774277 }
49514951 MVT PtrVT = TLI.getPointerTy(DL);
49524952 EVT IdxVT = EVT::getEVT(Idx->getType(), /*HandleUnknown=*/false);
49534953 if (IdxVT.bitsLT(PtrVT)) {
4954 IdxN = emitIntExt(IdxVT.getSimpleVT(), IdxN, PtrVT, /*IsZExt=*/false);
4954 IdxN = emitIntExt(IdxVT.getSimpleVT(), IdxN, PtrVT, /*isZExt=*/false);
49554955 IdxNIsKill = true;
49564956 } else if (IdxVT.bitsGT(PtrVT))
49574957 llvm_unreachable("AArch64 FastISel doesn't support types larger than i64");
118118 auto T = ArrayType::get(Type::getInt64Ty(C), 2);
119119 auto *GV = new GlobalVariable(
120120 M, T,
121 /*IsConstant=*/false, GlobalValue::ExternalLinkage,
121 /*isConstant=*/false, GlobalValue::ExternalLinkage,
122122 /*Initializer=*/Constant::getNullValue(T), RuntimeHandle,
123123 /*InsertBefore=*/nullptr, GlobalValue::NotThreadLocal,
124124 AMDGPUAS::GLOBAL_ADDRESS,
125 /*IsExternallyInitialized=*/false);
125 /*isExternallyInitialized=*/false);
126126 LLVM_DEBUG(dbgs() << "runtime handle created: " << *GV << '\n');
127127
128128 for (auto U : F.users()) {
22582258 unsigned TargetFlags = GV->hasDLLImportStorageClass()
22592259 ? ARMII::MO_DLLIMPORT
22602260 : ARMII::MO_NO_FLAG;
2261 Callee = DAG.getTargetGlobalAddress(GV, dl, PtrVt, /*Offset=*/0,
2261 Callee = DAG.getTargetGlobalAddress(GV, dl, PtrVt, /*offset=*/0,
22622262 TargetFlags);
22632263 if (GV->hasDLLImportStorageClass())
22642264 Callee =
29132913 auto M = const_cast(DAG.getMachineFunction().
29142914 getFunction().getParent());
29152915 auto GV = new GlobalVariable(
2916 *M, T, /*isConst=*/true, GlobalVariable::InternalLinkage, C,
2916 *M, T, /*isConstant=*/true, GlobalVariable::InternalLinkage, C,
29172917 Twine(DAG.getDataLayout().getPrivateGlobalPrefix()) + "CP" +
29182918 Twine(DAG.getMachineFunction().getFunctionNumber()) + "_" +
29192919 Twine(AFI->createPICLabelUId())
34663466 // FIXME: Once remat is capable of dealing with instructions with register
34673467 // operands, expand this into two nodes.
34683468 Result = DAG.getNode(ARMISD::Wrapper, DL, PtrVT,
3469 DAG.getTargetGlobalAddress(GV, DL, PtrVT, /*Offset=*/0,
3469 DAG.getTargetGlobalAddress(GV, DL, PtrVT, /*offset=*/0,
34703470 TargetFlags));
34713471 if (TargetFlags & (ARMII::MO_DLLIMPORT | ARMII::MO_COFFSTUB))
34723472 Result = DAG.getLoad(PtrVT, DL, DAG.getEntryNode(), Result,
3333
3434 LanaiELFObjectWriter::LanaiELFObjectWriter(uint8_t OSABI)
3535 : MCELFObjectTargetWriter(/*Is64Bit_=*/false, OSABI, ELF::EM_LANAI,
36 /*HasRelocationAddend=*/true) {}
36 /*HasRelocationAddend_=*/true) {}
3737
3838 unsigned LanaiELFObjectWriter::getRelocType(MCContext & /*Ctx*/,
3939 const MCValue & /*Target*/,
3535 } // end anonymous namespace
3636
3737 SystemZObjectWriter::SystemZObjectWriter(uint8_t OSABI)
38 : MCELFObjectTargetWriter(/*Is64Bit=*/true, OSABI, ELF::EM_S390,
39 /*HasRelocationAddend=*/ true) {}
38 : MCELFObjectTargetWriter(/*Is64Bit_=*/true, OSABI, ELF::EM_S390,
39 /*HasRelocationAddend_=*/ true) {}
4040
4141 // Return the relocation type for an absolute value of MCFixupKind Kind.
4242 static unsigned getAbsoluteReloc(unsigned Kind) {
193193 static const size_t BufBytes = 128;
194194 char Buf[BufBytes];
195195 auto Written = FP.convertToHexString(
196 Buf, /*hexDigits=*/0, /*upperCase=*/false, APFloat::rmNearestTiesToEven);
196 Buf, /*HexDigits=*/0, /*UpperCase=*/false, APFloat::rmNearestTiesToEven);
197197 (void)Written;
198198 assert(Written != 0);
199199 assert(Written < BufBytes);
114114 private:
115115 // Utility helper routines
116116 MVT::SimpleValueType getSimpleType(Type *Ty) {
117 EVT VT = TLI.getValueType(DL, Ty, /*HandleUnknown=*/true);
117 EVT VT = TLI.getValueType(DL, Ty, /*AllowUnknown=*/true);
118118 return VT.isSimple() ? VT.getSimpleVT().SimpleTy
119119 : MVT::INVALID_SIMPLE_VALUE_TYPE;
120120 }
8080 if (static_cast(Offset) <= std::numeric_limits::max()) {
8181 MI.getOperand(OffsetOperandNum).setImm(Offset);
8282 MI.getOperand(FIOperandNum)
83 .ChangeToRegister(FrameRegister, /*IsDef=*/false);
83 .ChangeToRegister(FrameRegister, /*isDef=*/false);
8484 return;
8585 }
8686 }
101101 MachineOperand &ImmMO = Def->getOperand(1);
102102 ImmMO.setImm(ImmMO.getImm() + uint32_t(FrameOffset));
103103 MI.getOperand(FIOperandNum)
104 .ChangeToRegister(FrameRegister, /*IsDef=*/false);
104 .ChangeToRegister(FrameRegister, /*isDef=*/false);
105105 return;
106106 }
107107 }
126126 .addReg(FrameRegister)
127127 .addReg(OffsetOp);
128128 }
129 MI.getOperand(FIOperandNum).ChangeToRegister(FIRegOperand, /*IsDef=*/false);
129 MI.getOperand(FIOperandNum).ChangeToRegister(FIRegOperand, /*isDef=*/false);
130130 }
131131
132132 Register
288288 }
289289
290290 bool X86FastISel::isTypeLegal(Type *Ty, MVT &VT, bool AllowI1) {
291 EVT evt = TLI.getValueType(DL, Ty, /*HandleUnknown=*/true);
291 EVT evt = TLI.getValueType(DL, Ty, /*AllowUnknown=*/true);
292292 if (evt == MVT::Other || !evt.isSimple())
293293 // Unhandled type. Halt "fast" selection and bail.
294294 return false;
31693169 MinFixedObjOffset -= std::abs(MinFixedObjOffset) % 8;
31703170 int64_t UnwindHelpOffset = MinFixedObjOffset - SlotSize;
31713171 int UnwindHelpFI =
3172 MFI.CreateFixedObject(SlotSize, UnwindHelpOffset, /*Immutable=*/false);
3172 MFI.CreateFixedObject(SlotSize, UnwindHelpOffset, /*IsImmutable=*/false);
31733173 EHInfo.UnwindHelpFrameIdx = UnwindHelpFI;
31743174
31753175 // Store -2 into UnwindHelp on function entry. We have to scan forwards past
30203020 // load from our portion of it. This assumes that if the first part of an
30213021 // argument is in memory, the rest will also be in memory.
30223022 int FI = MFI.CreateFixedObject(ArgVT.getStoreSize(), VA.getLocMemOffset(),
3023 /*Immutable=*/false);
3023 /*IsImmutable=*/false);
30243024 PartAddr = DAG.getFrameIndex(FI, PtrVT);
30253025 return DAG.getLoad(
30263026 ValVT, dl, Chain, PartAddr,
2371823718 // Set up a frame object for the return address.
2371923719 unsigned SlotSize = RegInfo->getSlotSize();
2372023720 FrameAddrIndex = MF.getFrameInfo().CreateFixedObject(
23721 SlotSize, /*Offset=*/0, /*IsImmutable=*/false);
23721 SlotSize, /*SPOffset=*/0, /*IsImmutable=*/false);
2372223722 FuncInfo->setFAIndex(FrameAddrIndex);
2372323723 }
2372423724 return DAG.getFrameIndex(FrameAddrIndex, VT);
249249
250250 // Do the probe.
251251 STI->getFrameLowering()->emitStackProbe(*MBB->getParent(), *MBB, MI, DL,
252 /*InPrologue=*/false);
252 /*InProlog=*/false);
253253 } else {
254254 // Sub
255255 BuildMI(*MBB, I, DL,
112112 StructType *FrameTy = StructType::create(C, "NoopCoro.Frame");
113113 auto *FramePtrTy = FrameTy->getPointerTo();
114114 auto *FnTy = FunctionType::get(Type::getVoidTy(C), FramePtrTy,
115 /*IsVarArgs=*/false);
115 /*isVarArg=*/false);
116116 auto *FnPtrTy = FnTy->getPointerTo();
117117 FrameTy->setBody({FnPtrTy, FnPtrTy});
118118
377377 StructType *FrameTy = StructType::create(C, Name);
378378 auto *FramePtrTy = FrameTy->getPointerTo();
379379 auto *FnTy = FunctionType::get(Type::getVoidTy(C), FramePtrTy,
380 /*IsVarArgs=*/false);
380 /*isVarArg=*/false);
381381 auto *FnPtrTy = FnTy->getPointerTo();
382382
383383 // Figure out how wide should be an integer type storing the suspend index.
865865
866866 LLVMContext &C = M.getContext();
867867 auto *FnTy = FunctionType::get(Type::getVoidTy(C), Type::getInt8PtrTy(C),
868 /*IsVarArgs=*/false);
868 /*isVarArg=*/false);
869869 Function *DevirtFn =
870870 Function::Create(FnTy, GlobalValue::LinkageTypes::PrivateLinkage,
871871 CORO_DEVIRT_TRIGGER_FN, &M);
966966 // Can it be decomposed into icmp eq (X & Mask), 0 ?
967967 if (llvm::decomposeBitTestICmp(ICmp->getOperand(0), ICmp->getOperand(1),
968968 Pred, X, UnsetBitsMask,
969 /*LookThruTrunc=*/false) &&
969 /*LookThroughTrunc=*/false) &&
970970 Pred == ICmpInst::ICMP_EQ)
971971 return true;
972972 // Is it icmp eq (X & Mask), 0 already?
623623 if (IsSigned && C1.isMinSignedValue() && C2.isAllOnesValue())
624624 return false;
625625
626 APInt Remainder(C1.getBitWidth(), /*Val=*/0ULL, IsSigned);
626 APInt Remainder(C1.getBitWidth(), /*val=*/0ULL, IsSigned);
627627 if (IsSigned)
628628 APInt::sdivrem(C1, C2, Quotient, Remainder);
629629 else
660660 // (X / C1) / C2 -> X / (C1*C2)
661661 if ((IsSigned && match(Op0, m_SDiv(m_Value(X), m_APInt(C1)))) ||
662662 (!IsSigned && match(Op0, m_UDiv(m_Value(X), m_APInt(C1))))) {
663 APInt Product(C1->getBitWidth(), /*Val=*/0ULL, IsSigned);
663 APInt Product(C1->getBitWidth(), /*val=*/0ULL, IsSigned);
664664 if (!multiplyOverflows(*C1, *C2, Product, IsSigned))
665665 return BinaryOperator::Create(I.getOpcode(), X,
666666 ConstantInt::get(Ty, Product));
668668
669669 if ((IsSigned && match(Op0, m_NSWMul(m_Value(X), m_APInt(C1)))) ||
670670 (!IsSigned && match(Op0, m_NUWMul(m_Value(X), m_APInt(C1))))) {
671 APInt Quotient(C1->getBitWidth(), /*Val=*/0ULL, IsSigned);
671 APInt Quotient(C1->getBitWidth(), /*val=*/0ULL, IsSigned);
672672
673673 // (X * C1) / C2 -> X / (C2 / C1) if C2 is a multiple of C1.
674674 if (isMultiple(*C2, *C1, Quotient, IsSigned)) {
692692 if ((IsSigned && match(Op0, m_NSWShl(m_Value(X), m_APInt(C1))) &&
693693 *C1 != C1->getBitWidth() - 1) ||
694694 (!IsSigned && match(Op0, m_NUWShl(m_Value(X), m_APInt(C1))))) {
695 APInt Quotient(C1->getBitWidth(), /*Val=*/0ULL, IsSigned);
695 APInt Quotient(C1->getBitWidth(), /*val=*/0ULL, IsSigned);
696696 APInt C1Shifted = APInt::getOneBitSet(
697697 C1->getBitWidth(), static_cast(C1->getLimitedValue()));
698698
353353
354354 if (!TargetTriple.isAndroid()) {
355355 Constant *C = M.getOrInsertGlobal("__hwasan_tls", IntptrTy, [&] {
356 auto *GV = new GlobalVariable(M, IntptrTy, /*isConstantGlobal=*/false,
356 auto *GV = new GlobalVariable(M, IntptrTy, /*isConstant=*/false,
357357 GlobalValue::ExternalLinkage, nullptr,
358358 "__hwasan_tls", nullptr,
359359 GlobalVariable::InitialExecTLSModel);
540540 // Find the smallest power of two bitwidth that's sufficient to hold Instr's
541541 // operands.
542542 auto OrigWidth = Instr->getType()->getIntegerBitWidth();
543 ConstantRange OperandRange(OrigWidth, /*isFullset=*/false);
543 ConstantRange OperandRange(OrigWidth, /*isFullSet=*/false);
544544 for (Value *Operand : Instr->operands()) {
545545 OperandRange = OperandRange.unionWith(
546546 LVI->getConstantRange(Operand, Instr->getParent()));
435435 } else if (Instruction *VI = dyn_cast(V)) {
436436 NewOperands.push_back(convert(VI, ToTy));
437437 } else if (ConstantFP *CF = dyn_cast(V)) {
438 APSInt Val(ToTy->getPrimitiveSizeInBits(), /*IsUnsigned=*/false);
438 APSInt Val(ToTy->getPrimitiveSizeInBits(), /*isUnsigned=*/false);
439439 bool Exact;
440440 CF->getValueAPF().convertToInteger(Val,
441441 APFloat::rmNearestTiesToEven,
31243124 MemAccessTy AccessTy = getAccessType(TTI, UserInst, Operand);
31253125 int64_t IncOffset = IncConst->getValue()->getSExtValue();
31263126 if (!isAlwaysFoldable(TTI, LSRUse::Address, AccessTy, /*BaseGV=*/nullptr,
3127 IncOffset, /*HaseBaseReg=*/false))
3127 IncOffset, /*HasBaseReg=*/false))
31283128 return false;
31293129
31303130 return true;
493493 KnownBits Known = computeKnownBits(Val, DL, /*Depth=*/0, AC, SI);
494494 // TODO Shouldn't this create a signed range?
495495 ConstantRange KnownBitsRange =
496 ConstantRange::fromKnownBits(Known, /*ForSigned=*/false);
496 ConstantRange::fromKnownBits(Known, /*IsSigned=*/false);
497497 const ConstantRange LVIRange = LVI->getConstantRange(Val, OrigBlock, SI);
498498 ConstantRange ValRange = KnownBitsRange.intersectWith(LVIRange);
499499 // We delegate removal of unreachable non-default cases to other passes. In
50245024 ArrayType *ArrayTy = ArrayType::get(ValueType, TableSize);
50255025 Constant *Initializer = ConstantArray::get(ArrayTy, TableContents);
50265026
5027 Array = new GlobalVariable(M, ArrayTy, /*constant=*/true,
5027 Array = new GlobalVariable(M, ArrayTy, /*isConstant=*/true,
50285028 GlobalVariable::PrivateLinkage, Initializer,
50295029 "switch.table." + FuncName);
50305030 Array->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);