[Remarks] Provide more information about auto-init calls

This now analyzes calls to both intrinsics and functions.

For intrinsics, grab the ones we know and care about (mem* family) and
analyze the arguments.

For calls, use TLI to get more information about the libcalls, then
analyze the arguments if known.

```
auto-init.c:4:7: remark: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 4096 bytes. [-Rpass-missed=annotation-remarks]
  int var[1024];
      ^
```

Differential Revision: https://reviews.llvm.org/D97489
This commit is contained in:
Francis Visoiu Mistrih 2021-02-25 09:49:53 -08:00
parent 4753a69a31
commit fee9abe69c
6 changed files with 389 additions and 118 deletions

View File

@ -16,13 +16,18 @@
#define LLVM_TRANSFORMS_UTILS_AUTOINITREMARK_H
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
namespace llvm {
class StoreInst;
class Instruction;
class OptimizationRemarkEmitter;
class CallInst;
class DataLayout;
class Instruction;
class IntrinsicInst;
class Value;
class OptimizationRemarkEmitter;
class OptimizationRemarkMissed;
class StoreInst;
// FIXME: Once we get to more remarks like this one, we need to re-evaluate how
// much of this logic should actually go into the remark emitter.
@ -30,13 +35,23 @@ struct AutoInitRemark {
OptimizationRemarkEmitter &ORE;
StringRef RemarkPass;
const DataLayout &DL;
const TargetLibraryInfo &TLI;
AutoInitRemark(OptimizationRemarkEmitter &ORE, StringRef RemarkPass,
const DataLayout &DL)
: ORE(ORE), RemarkPass(RemarkPass), DL(DL) {}
const DataLayout &DL, const TargetLibraryInfo &TLI)
: ORE(ORE), RemarkPass(RemarkPass), DL(DL), TLI(TLI) {}
void inspectStore(StoreInst &SI);
void inspectUnknown(Instruction &I);
void inspectIntrinsicCall(IntrinsicInst &II);
void inspectCall(CallInst &CI);
private:
template <typename FTy>
void inspectCallee(FTy F, bool KnownLibCall, OptimizationRemarkMissed &R);
void inspectKnownLibCall(CallInst &CI, LibFunc LF,
OptimizationRemarkMissed &R);
void inspectSizeOperand(Value *V, OptimizationRemarkMissed &R);
};
} // namespace llvm

View File

@ -17,6 +17,7 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
@ -30,7 +31,8 @@ using namespace llvm::ore;
#define REMARK_PASS DEBUG_TYPE
static void tryEmitAutoInitRemark(ArrayRef<Instruction *> Instructions,
OptimizationRemarkEmitter &ORE) {
OptimizationRemarkEmitter &ORE,
const TargetLibraryInfo &TLI) {
// For every auto-init annotation generate a separate remark.
for (Instruction *I : Instructions) {
if (!I->hasMetadata(LLVMContext::MD_annotation))
@ -42,7 +44,7 @@ static void tryEmitAutoInitRemark(ArrayRef<Instruction *> Instructions,
Function &F = *I->getParent()->getParent();
const DataLayout &DL = F.getParent()->getDataLayout();
AutoInitRemark Remark(ORE, REMARK_PASS, DL);
AutoInitRemark Remark(ORE, REMARK_PASS, DL, TLI);
// For some of them, we can provide more information:
// For stores:
@ -53,12 +55,29 @@ static void tryEmitAutoInitRemark(ArrayRef<Instruction *> Instructions,
continue;
}
// For intrinsics:
// * user-friendly name
// * size
if (auto *II = dyn_cast<IntrinsicInst>(I)) {
Remark.inspectIntrinsicCall(*II);
continue;
}
// For calls:
// * known/unknown function (e.g. the compiler knows bzero, but it doesn't
// know my_bzero)
// * memory operation size
if (auto *CI = dyn_cast<CallInst>(I)) {
Remark.inspectCall(*CI);
continue;
}
Remark.inspectUnknown(*I);
}
}
}
static void runImpl(Function &F) {
static void runImpl(Function &F, const TargetLibraryInfo &TLI) {
if (!OptimizationRemarkEmitter::allowExtraAnalysis(F, REMARK_PASS))
return;
@ -94,7 +113,7 @@ static void runImpl(Function &F) {
if (!KV.first)
continue;
tryEmitAutoInitRemark(KV.second, ORE);
tryEmitAutoInitRemark(KV.second, ORE, TLI);
}
}
@ -108,12 +127,15 @@ struct AnnotationRemarksLegacy : public FunctionPass {
}
bool runOnFunction(Function &F) override {
runImpl(F);
const TargetLibraryInfo &TLI =
getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F);
runImpl(F, TLI);
return false;
}
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll();
AU.addRequired<TargetLibraryInfoWrapperPass>();
}
};
@ -123,6 +145,7 @@ char AnnotationRemarksLegacy::ID = 0;
INITIALIZE_PASS_BEGIN(AnnotationRemarksLegacy, "annotation-remarks",
"Annotation Remarks", false, false)
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
INITIALIZE_PASS_END(AnnotationRemarksLegacy, "annotation-remarks",
"Annotation Remarks", false, false)
@ -132,6 +155,7 @@ FunctionPass *llvm::createAnnotationRemarksLegacyPass() {
PreservedAnalyses AnnotationRemarksPass::run(Function &F,
FunctionAnalysisManager &AM) {
runImpl(F);
auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
runImpl(F, TLI);
return PreservedAnalyses::all();
}

View File

@ -13,18 +13,13 @@
#include "llvm/Transforms/Utils/AutoInitRemark.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
using namespace llvm;
using namespace llvm::ore;
void AutoInitRemark::inspectStore(StoreInst &SI) {
bool Volatile = SI.isVolatile();
bool Atomic = SI.isAtomic();
int64_t Size = DL.getTypeStoreSize(SI.getOperand(0)->getType());
OptimizationRemarkMissed R(RemarkPass.data(), "AutoInitStore", &SI);
R << "Store inserted by -ftrivial-auto-var-init.\nStore size: "
<< NV("StoreSize", Size) << " bytes.";
static void volatileOrAtomicWithExtraArgs(bool Volatile, bool Atomic,
OptimizationRemarkMissed &R) {
if (Volatile)
R << " Volatile: " << NV("StoreVolatile", true) << ".";
if (Atomic)
@ -38,7 +33,17 @@ void AutoInitRemark::inspectStore(StoreInst &SI) {
R << " Volatile: " << NV("StoreVolatile", false) << ".";
if (!Atomic)
R << " Atomic: " << NV("StoreAtomic", false) << ".";
}
void AutoInitRemark::inspectStore(StoreInst &SI) {
bool Volatile = SI.isVolatile();
bool Atomic = SI.isAtomic();
int64_t Size = DL.getTypeStoreSize(SI.getOperand(0)->getType());
OptimizationRemarkMissed R(RemarkPass.data(), "AutoInitStore", &SI);
R << "Store inserted by -ftrivial-auto-var-init.\nStore size: "
<< NV("StoreSize", Size) << " bytes.";
volatileOrAtomicWithExtraArgs(Volatile, Atomic, R);
ORE.emit(R);
}
@ -47,3 +52,83 @@ void AutoInitRemark::inspectUnknown(Instruction &I) {
"AutoInitUnknownInstruction", &I)
<< "Initialization inserted by -ftrivial-auto-var-init.");
}
void AutoInitRemark::inspectIntrinsicCall(IntrinsicInst &II) {
SmallString<32> CallTo;
bool Atomic = false;
switch (II.getIntrinsicID()) {
case Intrinsic::memcpy:
CallTo = "memcpy";
break;
case Intrinsic::memmove:
CallTo = "memmove";
break;
case Intrinsic::memset:
CallTo = "memset";
break;
case Intrinsic::memcpy_element_unordered_atomic:
CallTo = "memcpy";
Atomic = true;
break;
case Intrinsic::memmove_element_unordered_atomic:
CallTo = "memmove";
Atomic = true;
break;
case Intrinsic::memset_element_unordered_atomic:
CallTo = "memset";
Atomic = true;
break;
default:
return inspectUnknown(II);
}
OptimizationRemarkMissed R(RemarkPass.data(), "AutoInitIntrinsic", &II);
inspectCallee(StringRef(CallTo), /*KnownLibCall=*/true, R);
inspectSizeOperand(II.getOperand(2), R);
auto *CIVolatile = dyn_cast<ConstantInt>(II.getOperand(3));
// No such thing as a memory intrinsic that is both atomic and volatile.
bool Volatile = !Atomic && CIVolatile && CIVolatile->getZExtValue();
volatileOrAtomicWithExtraArgs(Volatile, Atomic, R);
ORE.emit(R);
}
void AutoInitRemark::inspectCall(CallInst &CI) {
Function *F = CI.getCalledFunction();
if (!F)
return inspectUnknown(CI);
LibFunc LF;
bool KnownLibCall = TLI.getLibFunc(*F, LF) && TLI.has(LF);
OptimizationRemarkMissed R(RemarkPass.data(), "AutoInitCall", &CI);
inspectCallee(F, KnownLibCall, R);
inspectKnownLibCall(CI, LF, R);
ORE.emit(R);
}
template <typename FTy>
void AutoInitRemark::inspectCallee(FTy F, bool KnownLibCall,
OptimizationRemarkMissed &R) {
R << "Call to ";
if (!KnownLibCall)
R << NV("UnknownLibCall", "unknown") << " function ";
R << NV("Callee", F) << " inserted by -ftrivial-auto-var-init.";
}
void AutoInitRemark::inspectKnownLibCall(CallInst &CI, LibFunc LF,
OptimizationRemarkMissed &R) {
switch (LF) {
default:
return;
case LibFunc_bzero:
inspectSizeOperand(CI.getOperand(1), R);
break;
}
}
void AutoInitRemark::inspectSizeOperand(Value *V, OptimizationRemarkMissed &R) {
if (auto *Len = dyn_cast<ConstantInt>(V)) {
uint64_t Size = Len->getZExtValue();
R << " Memory operation size: " << NV("StoreSize", Size) << " bytes.";
}
}

View File

@ -44,6 +44,7 @@
; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
; CHECK-LTO-NEXT: Running pass: AnnotationRemarksPass
; CHECK-LTO-NEXT: Running analysis: TargetLibraryAnalysis
; CHECK-NEXT: Running pass: PrintModulePass
; Make sure we get the IR back out without changes when we print the module.

View File

@ -3,90 +3,165 @@
; Emit remarks for memcpy, memmove, memset, bzero.
define void @known_call(i8* %src, i8* %dst, i64 %size) {
; CHECK: Initialization inserted by -ftrivial-auto-var-init.
; CHECK: Call to memset inserted by -ftrivial-auto-var-init.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memset
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memset.p0i8.i64(i8* %dst, i8 0, i64 %size, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memcpy
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %size, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memmove
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memmove.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %size, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitCall
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: bzero
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: ...
call void @bzero(i8* %dst, i64 %size), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitCall
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call
; YAML-NEXT: Args:
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memset
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: ...
call i8* @memset(i8* %dst, i32 0, i64 32), !annotation !0, !dbg !DILocation(scope: !4)
ret void
}
; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes.
define void @known_call_with_size(i8* %src, i8* %dst) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_with_size
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memset
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Memory operation size: '
; YAML-NEXT: - StoreSize: '32'
; YAML-NEXT: - String: ' bytes.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memset.p0i8.i64(i8* %dst, i8 0, i64 32, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_with_size
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memcpy
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Memory operation size: '
; YAML-NEXT: - StoreSize: '32'
; YAML-NEXT: - String: ' bytes.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 32, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_with_size
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memmove
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Memory operation size: '
; YAML-NEXT: - StoreSize: '32'
; YAML-NEXT: - String: ' bytes.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memmove.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 32, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitCall
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_with_size
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: bzero
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Memory operation size: '
; YAML-NEXT: - StoreSize: '32'
; YAML-NEXT: - String: ' bytes.'
; YAML-NEXT: ...
call void @bzero(i8* %dst, i64 32), !annotation !0, !dbg !DILocation(scope: !4)
@ -95,34 +170,58 @@ define void @known_call_with_size(i8* %src, i8* %dst) {
; Emit remarks for memcpy, memmove, memset marked volatile.
define void @known_call_volatile(i8* %src, i8* %dst, i64 %size) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Volatile: true.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_volatile
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memset
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'true'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memset.p0i8.i64(i8* %dst, i8 0, i64 %size, i1 true), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Volatile: true.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_volatile
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memcpy
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'true'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %size, i1 true), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Volatile: true.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_volatile
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memmove
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'true'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memmove.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %size, i1 true), !annotation !0, !dbg !DILocation(scope: !4)
ret void
@ -130,34 +229,58 @@ define void @known_call_volatile(i8* %src, i8* %dst, i64 %size) {
; Emit remarks for memcpy, memmove, memset marked atomic.
define void @known_call_atomic(i8* %src, i8* %dst, i64 %size) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Atomic: true.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_atomic
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memset
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'true'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memset.element.unordered.atomic.p0i8.i64(i8* align 1 %dst, i8 0, i64 %size, i32 1), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Atomic: true.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_atomic
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memcpy
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'true'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %dst, i8* align 1 %src, i64 %size, i32 1), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Atomic: true.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_atomic
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memmove
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'true'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %dst, i8* align 1 %src, i64 %size, i32 1), !annotation !0, !dbg !DILocation(scope: !4)
ret void
@ -166,45 +289,83 @@ define void @known_call_atomic(i8* %src, i8* %dst, i64 %size) {
; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
; an alloca.
define void @known_call_with_size_alloca(i8* %src) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_with_size_alloca
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memset
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Memory operation size: '
; YAML-NEXT: - StoreSize: '1'
; YAML-NEXT: - String: ' bytes.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
%dst = alloca i8
call void @llvm.memset.p0i8.i64(i8* %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_with_size_alloca
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memcpy
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Memory operation size: '
; YAML-NEXT: - StoreSize: '1'
; YAML-NEXT: - String: ' bytes.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitIntrinsic
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_with_size_alloca
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: memmove
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Memory operation size: '
; YAML-NEXT: - StoreSize: '1'
; YAML-NEXT: - String: ' bytes.'
; YAML-NEXT: - String: ' Volatile: '
; YAML-NEXT: - StoreVolatile: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: - String: ' Atomic: '
; YAML-NEXT: - StoreAtomic: 'false'
; YAML-NEXT: - String: .
; YAML-NEXT: ...
call void @llvm.memmove.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: Name: AutoInitCall
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call_with_size_alloca
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: - String: 'Call to '
; YAML-NEXT: - Callee: bzero
; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
; YAML-NEXT: - String: ' Memory operation size: '
; YAML-NEXT: - StoreSize: '1'
; YAML-NEXT: - String: ' bytes.'
; YAML-NEXT: ...
call void @bzero(i8* %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
@ -214,15 +375,15 @@ define void @known_call_with_size_alloca(i8* %src) {
; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
; an alloca through a GEP.
define void @known_call_with_size_alloca_gep(i8* %src) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
%dst = alloca i8
%gep = getelementptr i8, i8* %dst, i32 0
call void @llvm.memset.p0i8.i64(i8* %gep, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %gep, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memmove.p0i8.p0i8.i64(i8* %gep, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @bzero(i8* %gep, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
ret void
}
@ -230,15 +391,15 @@ define void @known_call_with_size_alloca_gep(i8* %src) {
; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
; an alloca through a GEP in an array.
define void @known_call_with_size_alloca_gep_array(i8* %src) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
%dst = alloca [2 x i8]
%gep = getelementptr [2 x i8], [2 x i8]* %dst, i64 0, i64 0
call void @llvm.memset.p0i8.i64(i8* %gep, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %gep, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memmove.p0i8.p0i8.i64(i8* %gep, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @bzero(i8* %gep, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
ret void
}
@ -246,30 +407,30 @@ define void @known_call_with_size_alloca_gep_array(i8* %src) {
; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
; an alloca through a bitcast.
define void @known_call_with_size_alloca_bitcast(i8* %src) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
%dst = alloca [2 x i8]
%bc = bitcast [2 x i8]* %dst to i8*
call void @llvm.memset.p0i8.i64(i8* %bc, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %bc, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memmove.p0i8.p0i8.i64(i8* %bc, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @bzero(i8* %bc, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
ret void
}
; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to an alloca that has a DILocalVariable attached.
define void @known_call_with_size_alloca_di(i8* %src) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
%dst = alloca i8
call void @llvm.dbg.declare(metadata i8* %dst, metadata !6, metadata !DIExpression()), !dbg !DILocation(scope: !4)
call void @llvm.memset.p0i8.i64(i8* %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memmove.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @bzero(i8* %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
ret void
}
@ -277,15 +438,15 @@ define void @known_call_with_size_alloca_di(i8* %src) {
; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
; an alloca that has more than one DILocalVariable attached.
define void @known_call_with_size_alloca_di_multiple(i8* %src) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
%dst = alloca i8
call void @llvm.dbg.declare(metadata i8* %dst, metadata !6, metadata !DIExpression()), !dbg !DILocation(scope: !4)
call void @llvm.memset.p0i8.i64(i8* %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memmove.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @bzero(i8* %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
ret void
}
@ -293,7 +454,7 @@ define void @known_call_with_size_alloca_di_multiple(i8* %src) {
; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
; a PHI node that can be two different allocas.
define void @known_call_with_size_alloca_phi(i8* %src) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
entry:
%dst = alloca i8
%dst2 = alloca i8
@ -306,11 +467,11 @@ l1:
l2:
%phidst = phi i8* [ %dst, %l0 ], [ %dst2, %l1 ]
call void @llvm.memset.p0i8.i64(i8* %phidst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %phidst, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memmove.p0i8.p0i8.i64(i8* %phidst, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @bzero(i8* %phidst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
ret void
}
@ -319,7 +480,7 @@ l2:
; a PHI node that can be two different allocas, where one of it has multiple
; DILocalVariable.
define void @known_call_with_size_alloca_phi_di_multiple(i8* %src) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
entry:
%dst = alloca i8
%dst2 = alloca i8
@ -334,11 +495,11 @@ l1:
l2:
%phidst = phi i8* [ %dst, %l0 ], [ %dst2, %l1 ]
call void @llvm.memset.p0i8.i64(i8* %phidst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %phidst, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @llvm.memmove.p0i8.p0i8.i64(i8* %phidst, i8* %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
call void @bzero(i8* %phidst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
ret void
}
@ -353,6 +514,7 @@ declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture w
declare void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32 immarg) argmemonly nounwind willreturn
declare void @bzero(i8* nocapture, i64) nofree nounwind
declare i8* @memset(i8*, i32, i64)
!llvm.module.flags = !{!1}
!0 = !{ !"auto-init" }

View File

@ -33,23 +33,7 @@ define void @unknown_intrinsic(i32* %dst) {
ret void
}
; Emit a remark that reports a function call to a known libcall.
define void @known_call(i8* %dst) {
; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
; YAML-LABEL: --- !Missed
; YAML-NEXT: Pass: annotation-remarks
; YAML-NEXT: Name: AutoInitUnknownInstruction
; YAML-NEXT: DebugLoc:
; YAML-NEXT: Function: known_call
; YAML-NEXT: Args:
; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
; YAML-NEXT: ...
call i8* @memset(i8* %dst, i32 0, i64 32), !annotation !0, !dbg !DILocation(scope: !4)
ret void
}
declare i8* @llvm.returnaddress(i32) nounwind readnone
declare i8* @memset(i8*, i32, i64)
!llvm.module.flags = !{!1}
!0 = !{ !"auto-init" }