Lines Matching refs:I
72 void visitMemoryReference(Instruction &I, Value *Ptr,
76 void visitCallInst(CallInst &I);
77 void visitInvokeInst(InvokeInst &I);
78 void visitReturnInst(ReturnInst &I);
79 void visitLoadInst(LoadInst &I);
80 void visitStoreInst(StoreInst &I);
81 void visitXor(BinaryOperator &I);
82 void visitSub(BinaryOperator &I);
83 void visitLShr(BinaryOperator &I);
84 void visitAShr(BinaryOperator &I);
85 void visitShl(BinaryOperator &I);
86 void visitSDiv(BinaryOperator &I);
87 void visitUDiv(BinaryOperator &I);
88 void visitSRem(BinaryOperator &I);
89 void visitURem(BinaryOperator &I);
90 void visitAllocaInst(AllocaInst &I);
91 void visitVAArgInst(VAArgInst &I);
92 void visitIndirectBrInst(IndirectBrInst &I);
93 void visitExtractElementInst(ExtractElementInst &I);
94 void visitInsertElementInst(InsertElementInst &I);
95 void visitUnreachableInst(UnreachableInst &I);
198 Instruction &I = *CS.getInstruction(); in visitCallSite() local
201 visitMemoryReference(I, Callee, AliasAnalysis::UnknownSize, in visitCallSite()
207 &I); in visitCallSite()
216 "argument count", &I); in visitCallSite()
218 Assert1(FT->getReturnType() == I.getType(), in visitCallSite()
220 "callee return type", &I); in visitCallSite()
232 "callee parameter type", &I); in visitCallSite()
243 "Unusual: noalias argument aliases another argument", &I); in visitCallSite()
250 visitMemoryReference(I, Actual, AA->getTypeStoreSize(Ty), in visitCallSite()
264 "alloca", &I); in visitCallSite()
268 if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(&I)) in visitCallSite()
275 MemCpyInst *MCI = cast<MemCpyInst>(&I); in visitCallSite()
277 visitMemoryReference(I, MCI->getDest(), AliasAnalysis::UnknownSize, in visitCallSite()
280 visitMemoryReference(I, MCI->getSource(), AliasAnalysis::UnknownSize, in visitCallSite()
295 "Undefined behavior: memcpy source and destination overlap", &I); in visitCallSite()
299 MemMoveInst *MMI = cast<MemMoveInst>(&I); in visitCallSite()
301 visitMemoryReference(I, MMI->getDest(), AliasAnalysis::UnknownSize, in visitCallSite()
304 visitMemoryReference(I, MMI->getSource(), AliasAnalysis::UnknownSize, in visitCallSite()
310 MemSetInst *MSI = cast<MemSetInst>(&I); in visitCallSite()
312 visitMemoryReference(I, MSI->getDest(), AliasAnalysis::UnknownSize, in visitCallSite()
319 Assert1(I.getParent()->getParent()->isVarArg(), in visitCallSite()
321 &I); in visitCallSite()
323 visitMemoryReference(I, CS.getArgument(0), AliasAnalysis::UnknownSize, in visitCallSite()
327 visitMemoryReference(I, CS.getArgument(0), AliasAnalysis::UnknownSize, in visitCallSite()
329 visitMemoryReference(I, CS.getArgument(1), AliasAnalysis::UnknownSize, in visitCallSite()
333 visitMemoryReference(I, CS.getArgument(0), AliasAnalysis::UnknownSize, in visitCallSite()
341 visitMemoryReference(I, CS.getArgument(0), AliasAnalysis::UnknownSize, in visitCallSite()
347 void Lint::visitCallInst(CallInst &I) { in visitCallInst() argument
348 return visitCallSite(&I); in visitCallInst()
351 void Lint::visitInvokeInst(InvokeInst &I) { in visitInvokeInst() argument
352 return visitCallSite(&I); in visitInvokeInst()
355 void Lint::visitReturnInst(ReturnInst &I) { in visitReturnInst() argument
356 Function *F = I.getParent()->getParent(); in visitReturnInst()
359 &I); in visitReturnInst()
361 if (Value *V = I.getReturnValue()) { in visitReturnInst()
364 "Unusual: Returning alloca value", &I); in visitReturnInst()
370 void Lint::visitMemoryReference(Instruction &I, in visitMemoryReference() argument
380 "Undefined behavior: Null pointer dereference", &I); in visitMemoryReference()
382 "Undefined behavior: Undef pointer dereference", &I); in visitMemoryReference()
385 "Unusual: All-ones pointer dereference", &I); in visitMemoryReference()
388 "Unusual: Address one pointer dereference", &I); in visitMemoryReference()
393 "Undefined behavior: Write to read-only memory", &I); in visitMemoryReference()
396 "Undefined behavior: Write to text section", &I); in visitMemoryReference()
400 "Unusual: Load from function body", &I); in visitMemoryReference()
402 "Undefined behavior: Load from block address", &I); in visitMemoryReference()
406 "Undefined behavior: Call to block address", &I); in visitMemoryReference()
411 "Undefined behavior: Branch to non-blockaddress", &I); in visitMemoryReference()
450 "Undefined behavior: Buffer overflow", &I); in visitMemoryReference()
457 "Undefined behavior: Memory reference address is misaligned", &I); in visitMemoryReference()
461 void Lint::visitLoadInst(LoadInst &I) { in visitLoadInst() argument
462 visitMemoryReference(I, I.getPointerOperand(), in visitLoadInst()
463 AA->getTypeStoreSize(I.getType()), I.getAlignment(), in visitLoadInst()
464 I.getType(), MemRef::Read); in visitLoadInst()
467 void Lint::visitStoreInst(StoreInst &I) { in visitStoreInst() argument
468 visitMemoryReference(I, I.getPointerOperand(), in visitStoreInst()
469 AA->getTypeStoreSize(I.getOperand(0)->getType()), in visitStoreInst()
470 I.getAlignment(), in visitStoreInst()
471 I.getOperand(0)->getType(), MemRef::Write); in visitStoreInst()
474 void Lint::visitXor(BinaryOperator &I) { in visitXor() argument
475 Assert1(!isa<UndefValue>(I.getOperand(0)) || in visitXor()
476 !isa<UndefValue>(I.getOperand(1)), in visitXor()
477 "Undefined result: xor(undef, undef)", &I); in visitXor()
480 void Lint::visitSub(BinaryOperator &I) { in visitSub() argument
481 Assert1(!isa<UndefValue>(I.getOperand(0)) || in visitSub()
482 !isa<UndefValue>(I.getOperand(1)), in visitSub()
483 "Undefined result: sub(undef, undef)", &I); in visitSub()
486 void Lint::visitLShr(BinaryOperator &I) { in visitLShr() argument
488 dyn_cast<ConstantInt>(findValue(I.getOperand(1), /*OffsetOk=*/false))) in visitLShr()
489 Assert1(CI->getValue().ult(cast<IntegerType>(I.getType())->getBitWidth()), in visitLShr()
490 "Undefined result: Shift count out of range", &I); in visitLShr()
493 void Lint::visitAShr(BinaryOperator &I) { in visitAShr() argument
495 dyn_cast<ConstantInt>(findValue(I.getOperand(1), /*OffsetOk=*/false))) in visitAShr()
496 Assert1(CI->getValue().ult(cast<IntegerType>(I.getType())->getBitWidth()), in visitAShr()
497 "Undefined result: Shift count out of range", &I); in visitAShr()
500 void Lint::visitShl(BinaryOperator &I) { in visitShl() argument
502 dyn_cast<ConstantInt>(findValue(I.getOperand(1), /*OffsetOk=*/false))) in visitShl()
503 Assert1(CI->getValue().ult(cast<IntegerType>(I.getType())->getBitWidth()), in visitShl()
504 "Undefined result: Shift count out of range", &I); in visitShl()
531 for (unsigned I = 0, N = VecTy->getNumElements(); I != N; ++I) { in isZero() local
532 Constant *Elem = C->getAggregateElement(I); in isZero()
545 void Lint::visitSDiv(BinaryOperator &I) { in visitSDiv() argument
546 Assert1(!isZero(I.getOperand(1), DL), in visitSDiv()
547 "Undefined behavior: Division by zero", &I); in visitSDiv()
550 void Lint::visitUDiv(BinaryOperator &I) { in visitUDiv() argument
551 Assert1(!isZero(I.getOperand(1), DL), in visitUDiv()
552 "Undefined behavior: Division by zero", &I); in visitUDiv()
555 void Lint::visitSRem(BinaryOperator &I) { in visitSRem() argument
556 Assert1(!isZero(I.getOperand(1), DL), in visitSRem()
557 "Undefined behavior: Division by zero", &I); in visitSRem()
560 void Lint::visitURem(BinaryOperator &I) { in visitURem() argument
561 Assert1(!isZero(I.getOperand(1), DL), in visitURem()
562 "Undefined behavior: Division by zero", &I); in visitURem()
565 void Lint::visitAllocaInst(AllocaInst &I) { in visitAllocaInst() argument
566 if (isa<ConstantInt>(I.getArraySize())) in visitAllocaInst()
568 Assert1(&I.getParent()->getParent()->getEntryBlock() == I.getParent(), in visitAllocaInst()
569 "Pessimization: Static alloca outside of entry block", &I); in visitAllocaInst()
574 void Lint::visitVAArgInst(VAArgInst &I) { in visitVAArgInst() argument
575 visitMemoryReference(I, I.getOperand(0), AliasAnalysis::UnknownSize, 0, in visitVAArgInst()
579 void Lint::visitIndirectBrInst(IndirectBrInst &I) { in visitIndirectBrInst() argument
580 visitMemoryReference(I, I.getAddress(), AliasAnalysis::UnknownSize, 0, in visitIndirectBrInst()
583 Assert1(I.getNumDestinations() != 0, in visitIndirectBrInst()
584 "Undefined behavior: indirectbr with no destinations", &I); in visitIndirectBrInst()
587 void Lint::visitExtractElementInst(ExtractElementInst &I) { in visitExtractElementInst() argument
589 dyn_cast<ConstantInt>(findValue(I.getIndexOperand(), in visitExtractElementInst()
591 Assert1(CI->getValue().ult(I.getVectorOperandType()->getNumElements()), in visitExtractElementInst()
592 "Undefined result: extractelement index out of range", &I); in visitExtractElementInst()
595 void Lint::visitInsertElementInst(InsertElementInst &I) { in visitInsertElementInst() argument
597 dyn_cast<ConstantInt>(findValue(I.getOperand(2), in visitInsertElementInst()
599 Assert1(CI->getValue().ult(I.getType()->getNumElements()), in visitInsertElementInst()
600 "Undefined result: insertelement index out of range", &I); in visitInsertElementInst()
603 void Lint::visitUnreachableInst(UnreachableInst &I) { in visitUnreachableInst() argument
605 Assert1(&I == I.getParent()->begin() || in visitUnreachableInst()
606 std::prev(BasicBlock::iterator(&I))->mayHaveSideEffects(), in visitUnreachableInst()
608 "side effects", &I); in visitUnreachableInst()