629 lines · plain
1; RUN: opt -passes=annotation-remarks -o /dev/null -S -pass-remarks-output=%t.opt.yaml %s -pass-remarks-missed=annotation-remarks 2>&1 | FileCheck %s2; RUN: cat %t.opt.yaml | FileCheck -check-prefix=YAML %s3 4; Emit remarks for memcpy, memmove, memset, bzero.5define void @known_call(ptr %src, ptr %dst, i64 %size) {6; CHECK: Call to memset inserted by -ftrivial-auto-var-init.7; YAML-LABEL: --- !Missed8; YAML-NEXT: Pass: annotation-remarks9; YAML-NEXT: Name: AutoInitIntrinsic10; YAML-NEXT: DebugLoc:11; YAML-NEXT: Function: known_call12; YAML-NEXT: Args:13; YAML-NEXT: - String: 'Call to '14; YAML-NEXT: - Callee: memset15; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'16; YAML-NEXT: - String: ' Inlined: '17; YAML-NEXT: - StoreInlined: 'false'18; YAML-NEXT: - String: .19; YAML-NEXT: - String: ' Volatile: '20; YAML-NEXT: - StoreVolatile: 'false'21; YAML-NEXT: - String: .22; YAML-NEXT: - String: ' Atomic: '23; YAML-NEXT: - StoreAtomic: 'false'24; YAML-NEXT: - String: .25; YAML-NEXT: ...26 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 %size, i1 false), !annotation !0, !dbg !DILocation(scope: !4)27; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init.28; YAML-LABEL: --- !Missed29; YAML-NEXT: Pass: annotation-remarks30; YAML-NEXT: Name: AutoInitIntrinsic31; YAML-NEXT: DebugLoc:32; YAML-NEXT: Function: known_call33; YAML-NEXT: Args:34; YAML-NEXT: - String: 'Call to '35; YAML-NEXT: - Callee: memcpy36; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'37; YAML-NEXT: - String: ' Inlined: '38; YAML-NEXT: - StoreInlined: 'false'39; YAML-NEXT: - String: .40; YAML-NEXT: - String: ' Volatile: '41; YAML-NEXT: - StoreVolatile: 'false'42; YAML-NEXT: - String: .43; YAML-NEXT: - String: ' Atomic: '44; YAML-NEXT: - StoreAtomic: 'false'45; YAML-NEXT: - String: .46; YAML-NEXT: ...47 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %size, i1 false), !annotation !0, !dbg !DILocation(scope: !4)48; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init.49; YAML-LABEL: --- !Missed50; YAML-NEXT: Pass: annotation-remarks51; YAML-NEXT: Name: AutoInitIntrinsic52; YAML-NEXT: DebugLoc:53; YAML-NEXT: Function: known_call54; YAML-NEXT: Args:55; YAML-NEXT: - String: 'Call to '56; YAML-NEXT: - Callee: memmove57; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'58; YAML-NEXT: - String: ' Inlined: '59; YAML-NEXT: - StoreInlined: 'false'60; YAML-NEXT: - String: .61; YAML-NEXT: - String: ' Volatile: '62; YAML-NEXT: - StoreVolatile: 'false'63; YAML-NEXT: - String: .64; YAML-NEXT: - String: ' Atomic: '65; YAML-NEXT: - StoreAtomic: 'false'66; YAML-NEXT: - String: .67; YAML-NEXT: ...68 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 %size, i1 false), !annotation !0, !dbg !DILocation(scope: !4)69; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init.70; YAML-LABEL: --- !Missed71; YAML-NEXT: Pass: annotation-remarks72; YAML-NEXT: Name: AutoInitCall73; YAML-NEXT: DebugLoc:74; YAML-NEXT: Function: known_call75; YAML-NEXT: Args:76; YAML-NEXT: - String: 'Call to '77; YAML-NEXT: - Callee: bzero78; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'79; YAML-NEXT: ...80 call void @bzero(ptr %dst, i64 %size), !annotation !0, !dbg !DILocation(scope: !4)81; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init.82; YAML-LABEL: --- !Missed83; YAML-NEXT: Pass: annotation-remarks84; YAML-NEXT: Name: AutoInitCall85; YAML-NEXT: DebugLoc:86; YAML-NEXT: Function: known_call87; YAML-NEXT: Args:88; YAML-NEXT: - String: 'Call to '89; YAML-NEXT: - Callee: memset90; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'91; YAML-NEXT: - String: ' Memory operation size: '92; YAML-NEXT: - StoreSize: '32'93; YAML-NEXT: - String: ' bytes.'94; YAML-NEXT: ...95 call ptr @memset(ptr %dst, i32 0, i64 32), !annotation !0, !dbg !DILocation(scope: !4)96 ret void97}98 99; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes.100define void @known_call_with_size(ptr %src, ptr %dst) {101; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.102; YAML-LABEL: --- !Missed103; YAML-NEXT: Pass: annotation-remarks104; YAML-NEXT: Name: AutoInitIntrinsic105; YAML-NEXT: DebugLoc:106; YAML-NEXT: Function: known_call_with_size107; YAML-NEXT: Args:108; YAML-NEXT: - String: 'Call to '109; YAML-NEXT: - Callee: memset110; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'111; YAML-NEXT: - String: ' Memory operation size: '112; YAML-NEXT: - StoreSize: '32'113; YAML-NEXT: - String: ' bytes.'114; YAML-NEXT: - String: ' Inlined: '115; YAML-NEXT: - StoreInlined: 'false'116; YAML-NEXT: - String: .117; YAML-NEXT: - String: ' Volatile: '118; YAML-NEXT: - StoreVolatile: 'false'119; YAML-NEXT: - String: .120; YAML-NEXT: - String: ' Atomic: '121; YAML-NEXT: - StoreAtomic: 'false'122; YAML-NEXT: - String: .123; YAML-NEXT: ...124 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 32, i1 false), !annotation !0, !dbg !DILocation(scope: !4)125; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.126; YAML-LABEL: --- !Missed127; YAML-NEXT: Pass: annotation-remarks128; YAML-NEXT: Name: AutoInitIntrinsic129; YAML-NEXT: DebugLoc:130; YAML-NEXT: Function: known_call_with_size131; YAML-NEXT: Args:132; YAML-NEXT: - String: 'Call to '133; YAML-NEXT: - Callee: memcpy134; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'135; YAML-NEXT: - String: ' Memory operation size: '136; YAML-NEXT: - StoreSize: '32'137; YAML-NEXT: - String: ' bytes.'138; YAML-NEXT: - String: ' Inlined: '139; YAML-NEXT: - StoreInlined: 'false'140; YAML-NEXT: - String: .141; YAML-NEXT: - String: ' Volatile: '142; YAML-NEXT: - StoreVolatile: 'false'143; YAML-NEXT: - String: .144; YAML-NEXT: - String: ' Atomic: '145; YAML-NEXT: - StoreAtomic: 'false'146; YAML-NEXT: - String: .147; YAML-NEXT: ...148 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 32, i1 false), !annotation !0, !dbg !DILocation(scope: !4)149; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.150; YAML-LABEL: --- !Missed151; YAML-NEXT: Pass: annotation-remarks152; YAML-NEXT: Name: AutoInitIntrinsic153; YAML-NEXT: DebugLoc:154; YAML-NEXT: Function: known_call_with_size155; YAML-NEXT: Args:156; YAML-NEXT: - String: 'Call to '157; YAML-NEXT: - Callee: memmove158; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'159; YAML-NEXT: - String: ' Memory operation size: '160; YAML-NEXT: - StoreSize: '32'161; YAML-NEXT: - String: ' bytes.'162; YAML-NEXT: - String: ' Inlined: '163; YAML-NEXT: - StoreInlined: 'false'164; YAML-NEXT: - String: .165; YAML-NEXT: - String: ' Volatile: '166; YAML-NEXT: - StoreVolatile: 'false'167; YAML-NEXT: - String: .168; YAML-NEXT: - String: ' Atomic: '169; YAML-NEXT: - StoreAtomic: 'false'170; YAML-NEXT: - String: .171; YAML-NEXT: ...172 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 32, i1 false), !annotation !0, !dbg !DILocation(scope: !4)173; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.174; YAML-LABEL: --- !Missed175; YAML-NEXT: Pass: annotation-remarks176; YAML-NEXT: Name: AutoInitCall177; YAML-NEXT: DebugLoc:178; YAML-NEXT: Function: known_call_with_size179; YAML-NEXT: Args:180; YAML-NEXT: - String: 'Call to '181; YAML-NEXT: - Callee: bzero182; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'183; YAML-NEXT: - String: ' Memory operation size: '184; YAML-NEXT: - StoreSize: '32'185; YAML-NEXT: - String: ' bytes.'186; YAML-NEXT: ...187 call void @bzero(ptr %dst, i64 32), !annotation !0, !dbg !DILocation(scope: !4)188 189 ret void190}191 192; Emit remarks for memcpy, memmove, memset marked volatile.193define void @known_call_volatile(ptr %src, ptr %dst, i64 %size) {194; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Volatile: true.195; YAML-LABEL: --- !Missed196; YAML-NEXT: Pass: annotation-remarks197; YAML-NEXT: Name: AutoInitIntrinsic198; YAML-NEXT: DebugLoc:199; YAML-NEXT: Function: known_call_volatile200; YAML-NEXT: Args:201; YAML-NEXT: - String: 'Call to '202; YAML-NEXT: - Callee: memset203; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'204; YAML-NEXT: - String: ' Volatile: '205; YAML-NEXT: - StoreVolatile: 'true'206; YAML-NEXT: - String: .207; YAML-NEXT: - String: ' Inlined: '208; YAML-NEXT: - StoreInlined: 'false'209; YAML-NEXT: - String: .210; YAML-NEXT: - String: ' Atomic: '211; YAML-NEXT: - StoreAtomic: 'false'212; YAML-NEXT: - String: .213; YAML-NEXT: ...214 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 %size, i1 true), !annotation !0, !dbg !DILocation(scope: !4)215; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Volatile: true.216; YAML-LABEL: --- !Missed217; YAML-NEXT: Pass: annotation-remarks218; YAML-NEXT: Name: AutoInitIntrinsic219; YAML-NEXT: DebugLoc:220; YAML-NEXT: Function: known_call_volatile221; YAML-NEXT: Args:222; YAML-NEXT: - String: 'Call to '223; YAML-NEXT: - Callee: memcpy224; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'225; YAML-NEXT: - String: ' Volatile: '226; YAML-NEXT: - StoreVolatile: 'true'227; YAML-NEXT: - String: .228; YAML-NEXT: - String: ' Inlined: '229; YAML-NEXT: - StoreInlined: 'false'230; YAML-NEXT: - String: .231; YAML-NEXT: - String: ' Atomic: '232; YAML-NEXT: - StoreAtomic: 'false'233; YAML-NEXT: - String: .234; YAML-NEXT: ...235 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %size, i1 true), !annotation !0, !dbg !DILocation(scope: !4)236; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Volatile: true.237; YAML-LABEL: --- !Missed238; YAML-NEXT: Pass: annotation-remarks239; YAML-NEXT: Name: AutoInitIntrinsic240; YAML-NEXT: DebugLoc:241; YAML-NEXT: Function: known_call_volatile242; YAML-NEXT: Args:243; YAML-NEXT: - String: 'Call to '244; YAML-NEXT: - Callee: memmove245; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'246; YAML-NEXT: - String: ' Volatile: '247; YAML-NEXT: - StoreVolatile: 'true'248; YAML-NEXT: - String: .249; YAML-NEXT: - String: ' Inlined: '250; YAML-NEXT: - StoreInlined: 'false'251; YAML-NEXT: - String: .252; YAML-NEXT: - String: ' Atomic: '253; YAML-NEXT: - StoreAtomic: 'false'254; YAML-NEXT: - String: .255; YAML-NEXT: ...256 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 %size, i1 true), !annotation !0, !dbg !DILocation(scope: !4)257 ret void258}259 260; Emit remarks for memcpy, memmove, memset marked atomic.261define void @known_call_atomic(ptr %src, ptr %dst, i64 %size) {262; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Atomic: true.263; YAML-LABEL: --- !Missed264; YAML-NEXT: Pass: annotation-remarks265; YAML-NEXT: Name: AutoInitIntrinsic266; YAML-NEXT: DebugLoc:267; YAML-NEXT: Function: known_call_atomic268; YAML-NEXT: Args:269; YAML-NEXT: - String: 'Call to '270; YAML-NEXT: - Callee: memset271; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'272; YAML-NEXT: - String: ' Atomic: '273; YAML-NEXT: - StoreAtomic: 'true'274; YAML-NEXT: - String: .275; YAML-NEXT: - String: ' Inlined: '276; YAML-NEXT: - StoreInlined: 'false'277; YAML-NEXT: - String: .278; YAML-NEXT: - String: ' Volatile: '279; YAML-NEXT: - StoreVolatile: 'false'280; YAML-NEXT: - String: .281; YAML-NEXT: ...282 call void @llvm.memset.element.unordered.atomic.p0.i64(ptr align 1 %dst, i8 0, i64 %size, i32 1), !annotation !0, !dbg !DILocation(scope: !4)283; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Atomic: true.284; YAML-LABEL: --- !Missed285; YAML-NEXT: Pass: annotation-remarks286; YAML-NEXT: Name: AutoInitIntrinsic287; YAML-NEXT: DebugLoc:288; YAML-NEXT: Function: known_call_atomic289; YAML-NEXT: Args:290; YAML-NEXT: - String: 'Call to '291; YAML-NEXT: - Callee: memcpy292; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'293; YAML-NEXT: - String: ' Atomic: '294; YAML-NEXT: - StoreAtomic: 'true'295; YAML-NEXT: - String: .296; YAML-NEXT: - String: ' Inlined: '297; YAML-NEXT: - StoreInlined: 'false'298; YAML-NEXT: - String: .299; YAML-NEXT: - String: ' Volatile: '300; YAML-NEXT: - StoreVolatile: 'false'301; YAML-NEXT: - String: .302; YAML-NEXT: ...303 call void @llvm.memcpy.element.unordered.atomic.p0.p0.i64(ptr align 1 %dst, ptr align 1 %src, i64 %size, i32 1), !annotation !0, !dbg !DILocation(scope: !4)304; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Atomic: true.305; YAML-LABEL: --- !Missed306; YAML-NEXT: Pass: annotation-remarks307; YAML-NEXT: Name: AutoInitIntrinsic308; YAML-NEXT: DebugLoc:309; YAML-NEXT: Function: known_call_atomic310; YAML-NEXT: Args:311; YAML-NEXT: - String: 'Call to '312; YAML-NEXT: - Callee: memmove313; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'314; YAML-NEXT: - String: ' Atomic: '315; YAML-NEXT: - StoreAtomic: 'true'316; YAML-NEXT: - String: .317; YAML-NEXT: - String: ' Inlined: '318; YAML-NEXT: - StoreInlined: 'false'319; YAML-NEXT: - String: .320; YAML-NEXT: - String: ' Volatile: '321; YAML-NEXT: - StoreVolatile: 'false'322; YAML-NEXT: - String: .323; YAML-NEXT: ...324 call void @llvm.memmove.element.unordered.atomic.p0.p0.i64(ptr align 1 %dst, ptr align 1 %src, i64 %size, i32 1), !annotation !0, !dbg !DILocation(scope: !4)325 ret void326}327 328; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to329; an alloca.330define void @known_call_with_size_alloca(ptr %src) {331; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.332; CHECK-NEXT: Variables: dst (1 bytes).333; YAML-LABEL: --- !Missed334; YAML-NEXT: Pass: annotation-remarks335; YAML-NEXT: Name: AutoInitIntrinsic336; YAML-NEXT: DebugLoc:337; YAML-NEXT: Function: known_call_with_size_alloca338; YAML-NEXT: Args:339; YAML-NEXT: - String: 'Call to '340; YAML-NEXT: - Callee: memset341; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'342; YAML-NEXT: - String: ' Memory operation size: '343; YAML-NEXT: - StoreSize: '1'344; YAML-NEXT: - String: ' bytes.'345; YAML-NEXT: - String: "\n Written Variables: "346; YAML-NEXT: - WVarName: dst347; YAML-NEXT: - String: ' ('348; YAML-NEXT: - WVarSize: '1'349; YAML-NEXT: - String: ' bytes)'350; YAML-NEXT: - String: .351; YAML-NEXT: - String: ' Inlined: '352; YAML-NEXT: - StoreInlined: 'false'353; YAML-NEXT: - String: .354; YAML-NEXT: - String: ' Volatile: '355; YAML-NEXT: - StoreVolatile: 'false'356; YAML-NEXT: - String: .357; YAML-NEXT: - String: ' Atomic: '358; YAML-NEXT: - StoreAtomic: 'false'359; YAML-NEXT: - String: .360; YAML-NEXT: ...361 %dst = alloca i8362 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)363; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.364; CHECK-NEXT: Variables: dst (1 bytes).365; YAML-LABEL: --- !Missed366; YAML-NEXT: Pass: annotation-remarks367; YAML-NEXT: Name: AutoInitIntrinsic368; YAML-NEXT: DebugLoc:369; YAML-NEXT: Function: known_call_with_size_alloca370; YAML-NEXT: Args:371; YAML-NEXT: - String: 'Call to '372; YAML-NEXT: - Callee: memcpy373; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'374; YAML-NEXT: - String: ' Memory operation size: '375; YAML-NEXT: - StoreSize: '1'376; YAML-NEXT: - String: ' bytes.'377; YAML-NEXT: - String: "\n Written Variables: "378; YAML-NEXT: - WVarName: dst379; YAML-NEXT: - String: ' ('380; YAML-NEXT: - WVarSize: '1'381; YAML-NEXT: - String: ' bytes)'382; YAML-NEXT: - String: .383; YAML-NEXT: - String: ' Inlined: '384; YAML-NEXT: - StoreInlined: 'false'385; YAML-NEXT: - String: .386; YAML-NEXT: - String: ' Volatile: '387; YAML-NEXT: - StoreVolatile: 'false'388; YAML-NEXT: - String: .389; YAML-NEXT: - String: ' Atomic: '390; YAML-NEXT: - StoreAtomic: 'false'391; YAML-NEXT: - String: .392; YAML-NEXT: ...393 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)394; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.395; CHECK-NEXT: Variables: dst (1 bytes).396; YAML-LABEL: --- !Missed397; YAML-NEXT: Pass: annotation-remarks398; YAML-NEXT: Name: AutoInitIntrinsic399; YAML-NEXT: DebugLoc:400; YAML-NEXT: Function: known_call_with_size_alloca401; YAML-NEXT: Args:402; YAML-NEXT: - String: 'Call to '403; YAML-NEXT: - Callee: memmove404; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'405; YAML-NEXT: - String: ' Memory operation size: '406; YAML-NEXT: - StoreSize: '1'407; YAML-NEXT: - String: ' bytes.'408; YAML-NEXT: - String: "\n Written Variables: "409; YAML-NEXT: - WVarName: dst410; YAML-NEXT: - String: ' ('411; YAML-NEXT: - WVarSize: '1'412; YAML-NEXT: - String: ' bytes)'413; YAML-NEXT: - String: .414; YAML-NEXT: - String: ' Inlined: '415; YAML-NEXT: - StoreInlined: 'false'416; YAML-NEXT: - String: .417; YAML-NEXT: - String: ' Volatile: '418; YAML-NEXT: - StoreVolatile: 'false'419; YAML-NEXT: - String: .420; YAML-NEXT: - String: ' Atomic: '421; YAML-NEXT: - StoreAtomic: 'false'422; YAML-NEXT: - String: .423; YAML-NEXT: ...424 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)425; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.426; CHECK-NEXT: Variables: dst (1 bytes).427; YAML-LABEL: --- !Missed428; YAML-NEXT: Pass: annotation-remarks429; YAML-NEXT: Name: AutoInitCall430; YAML-NEXT: DebugLoc:431; YAML-NEXT: Function: known_call_with_size_alloca432; YAML-NEXT: Args:433; YAML-NEXT: - String: 'Call to '434; YAML-NEXT: - Callee: bzero435; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'436; YAML-NEXT: - String: ' Memory operation size: '437; YAML-NEXT: - StoreSize: '1'438; YAML-NEXT: - String: ' bytes.'439; YAML-NEXT: - String: "\n Written Variables: "440; YAML-NEXT: - WVarName: dst441; YAML-NEXT: - String: ' ('442; YAML-NEXT: - WVarSize: '1'443; YAML-NEXT: - String: ' bytes)'444; YAML-NEXT: - String: .445; YAML-NEXT: ...446 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)447 448 ret void449}450 451; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to452; an alloca through a GEP.453define void @known_call_with_size_alloca_gep(ptr %src) {454; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.455; CHECK-NEXT: Variables: dst (1 bytes).456 %dst = alloca i8457 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)458; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.459; CHECK-NEXT: Variables: dst (1 bytes).460 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)461; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.462; CHECK-NEXT: Variables: dst (1 bytes).463 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)464; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.465; CHECK-NEXT: Variables: dst (1 bytes).466 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)467 ret void468}469 470; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to471; an alloca through a GEP in an array.472define void @known_call_with_size_alloca_gep_array(ptr %src) {473; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.474; CHECK-NEXT: Variables: dst (2 bytes).475 %dst = alloca [2 x i8]476 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)477; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.478; CHECK-NEXT: Variables: dst (2 bytes).479 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)480; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.481; CHECK-NEXT: Variables: dst (2 bytes).482 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)483; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.484; CHECK-NEXT: Variables: dst (2 bytes).485 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)486 ret void487}488 489; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to490; an alloca through a bitcast.491define void @known_call_with_size_alloca_bitcast(ptr %src) {492; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.493; CHECK-NEXT: Variables: dst (2 bytes).494 %dst = alloca [2 x i8]495 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)496; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.497; CHECK-NEXT: Variables: dst (2 bytes).498 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)499; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.500; CHECK-NEXT: Variables: dst (2 bytes).501 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)502; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.503; CHECK-NEXT: Variables: dst (2 bytes).504 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)505 ret void506}507 508; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to an alloca that has a DILocalVariable attached.509define void @known_call_with_size_alloca_di(ptr %src) {510; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.511; CHECK-NEXT: Variables: destination (1 bytes).512 %dst = alloca i8513 call void @llvm.dbg.declare(metadata ptr %dst, metadata !6, metadata !DIExpression()), !dbg !DILocation(scope: !4)514 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)515; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.516; CHECK-NEXT: Variables: destination (1 bytes).517 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)518; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.519; CHECK-NEXT: Variables: destination (1 bytes).520 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)521; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.522; CHECK-NEXT: Variables: destination (1 bytes).523 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)524 ret void525}526 527; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to528; an alloca that has more than one DILocalVariable attached.529define void @known_call_with_size_alloca_di_multiple(ptr %src) {530; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.531; CHECK-NEXT: Variables: destination (1 bytes).532 %dst = alloca i8533 call void @llvm.dbg.declare(metadata ptr %dst, metadata !6, metadata !DIExpression()), !dbg !DILocation(scope: !4)534 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)535; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.536; CHECK-NEXT: Variables: destination (1 bytes).537 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)538; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.539; CHECK-NEXT: Variables: destination (1 bytes).540 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)541; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.542; CHECK-NEXT: Variables: destination (1 bytes).543 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)544 ret void545}546 547; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to548; a PHI node that can be two different allocas.549define void @known_call_with_size_alloca_phi(ptr %src) {550; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.551; CHECK-NEXT: Variables: dst2 (1 bytes), dst (1 bytes).552entry:553 %dst = alloca i8554 %dst2 = alloca i8555 %cmp = icmp eq i32 undef, undef556 br i1 %cmp, label %l0, label %l1557l0:558 br label %l2559l1:560 br label %l2561l2:562 %phidst = phi ptr [ %dst, %l0 ], [ %dst2, %l1 ]563 call void @llvm.memset.p0.i64(ptr %phidst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)564; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.565; CHECK-NEXT: Variables: dst2 (1 bytes), dst (1 bytes).566 call void @llvm.memcpy.p0.p0.i64(ptr %phidst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)567; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.568; CHECK-NEXT: Variables: dst2 (1 bytes), dst (1 bytes).569 call void @llvm.memmove.p0.p0.i64(ptr %phidst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)570; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.571; CHECK-NEXT: Variables: dst2 (1 bytes), dst (1 bytes).572 call void @bzero(ptr %phidst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)573 ret void574}575 576; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to577; a PHI node that can be two different allocas, where one of it has multiple578; DILocalVariable.579define void @known_call_with_size_alloca_phi_di_multiple(ptr %src) {580; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.581; CHECK-NEXT: Variables: dst2 (1 bytes), destination2 (1 bytes), destination (1 bytes).582entry:583 %dst = alloca i8584 %dst2 = alloca i8585 call void @llvm.dbg.declare(metadata ptr %dst, metadata !6, metadata !DIExpression()), !dbg !DILocation(scope: !4)586 call void @llvm.dbg.declare(metadata ptr %dst, metadata !7, metadata !DIExpression()), !dbg !DILocation(scope: !4)587 %cmp = icmp eq i32 undef, undef588 br i1 %cmp, label %l0, label %l1589l0:590 br label %l2591l1:592 br label %l2593l2:594 %phidst = phi ptr [ %dst, %l0 ], [ %dst2, %l1 ]595 call void @llvm.memset.p0.i64(ptr %phidst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)596; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.597; CHECK-NEXT: Variables: dst2 (1 bytes), destination2 (1 bytes), destination (1 bytes).598 call void @llvm.memcpy.p0.p0.i64(ptr %phidst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)599; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.600; CHECK-NEXT: Variables: dst2 (1 bytes), destination2 (1 bytes), destination (1 bytes).601 call void @llvm.memmove.p0.p0.i64(ptr %phidst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)602; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.603; CHECK-NEXT: Variables: dst2 (1 bytes), destination2 (1 bytes), destination (1 bytes).604 call void @bzero(ptr %phidst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)605 ret void606}607 608declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone speculatable willreturn609declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) argmemonly nounwind willreturn writeonly610declare void @llvm.memmove.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1 immarg) argmemonly nounwind willreturn611declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) argmemonly nounwind willreturn612 613declare void @llvm.memset.element.unordered.atomic.p0.i64(ptr nocapture writeonly, i8, i64, i32 immarg) argmemonly nounwind willreturn writeonly614declare void @llvm.memcpy.element.unordered.atomic.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i32 immarg) argmemonly nounwind willreturn615declare void @llvm.memmove.element.unordered.atomic.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i32 immarg) argmemonly nounwind willreturn616 617declare void @bzero(ptr nocapture, i64) nofree nounwind618declare ptr @memset(ptr, i32, i64)619 620!llvm.module.flags = !{!1}621!0 = !{ !"auto-init" }622!1 = !{i32 2, !"Debug Info Version", i32 3}623!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3)624!3 = !DIFile(filename: "file", directory: "")625!4 = distinct !DISubprogram(name: "function", scope: !3, file: !3, unit: !2)626!5 = !DIBasicType(name: "byte", size: 8)627!6 = !DILocalVariable(name: "destination", scope: !4, file: !3, type: !5)628!7 = !DILocalVariable(name: "destination2", scope: !4, file: !3, type: !5)629