llvm.org GIT mirror llvm / 24ab21c
Don't forget that strcpy and friends return a pointer to the destination, so it's not a dead store if that pointer is used. Whoops! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164583 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 7 years ago
2 changed file(s) with 12 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
265265 }
266266 }
267267
268 if (CallSite(I)) // If we assume hasMemoryWrite(I) is true,
269 return true; // then there's nothing left to check.
268 if (CallSite CS = I)
269 return CS.getInstruction()->use_empty();
270270
271271 return false;
272272 }
4343 ret void
4444 }
4545
46 define void @test5(i8* nocapture %src) {
47 ; CHECK: @test5
48 %dest = alloca [100 x i8], align 16
49 %arraydecay = getelementptr inbounds [100 x i8]* %dest, i64 0, i64 0
50 %call = call i8* @strcpy(i8* %arraydecay, i8* %src)
51 ; CHECK: %call = call i8* @strcpy
52 %arrayidx = getelementptr inbounds i8* %call, i64 10
53 store i8 97, i8* %arrayidx, align 1
54 ret void
55 }