<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Thanks!</p>
<p>Philip<br>
</p>
<div class="moz-cite-prefix">On 8/13/19 9:47 AM, Dávid Bolvanský
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:44344FFD-A65E-4588-ABC7-891A656E6B7A@gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<span style="font-size: 12pt; font-family: Helvetica;">rL368715</span><br>
<p style="margin: 0px; font-stretch: normal; font-size: 12px;
line-height: normal; font-family: Helvetica;"><span
style="font-size: 12pt;"><br>
</span></p>
<p style="margin: 0px; font-stretch: normal; font-size: 12px;
line-height: normal; font-family: Helvetica;"><span
style="font-size: 12pt;">Thanks!</span></p>
<div dir="ltr"><br>
Dňa 13. 8. 2019 o 18:14 užívateľ Philip Reames <<a
href="mailto:listmail@philipreames.com" moz-do-not-send="true">listmail@philipreames.com</a>>
napísal:<br>
<br>
</div>
<blockquote type="cite">
<div dir="ltr"><span>In rare cases, it looks like this could
loose information. I think what you actually want would be
the max of the original deref information, and the length.</span><br>
<span></span><br>
<span>Philip</span><br>
<span></span><br>
<span>On 8/13/19 2:11 AM, David Bolvansky via llvm-commits
wrote:</span><br>
<blockquote type="cite"><span>Author: xbolva00</span><br>
</blockquote>
<blockquote type="cite"><span>Date: Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>New Revision: 368657</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project?rev=368657&view=rev"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project?rev=368657&view=rev</a></span><br>
</blockquote>
<blockquote type="cite"><span>Log:</span><br>
</blockquote>
<blockquote type="cite"><span>[SimplifyLibCalls] Add
dereferenceable bytes from known callsites</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Summary:</span><br>
</blockquote>
<blockquote type="cite"><span>int mm(char *a, char *b) {</span><br>
</blockquote>
<blockquote type="cite"><span> return memcmp(a,b,16);</span><br>
</blockquote>
<blockquote type="cite"><span>}</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Currently:</span><br>
</blockquote>
<blockquote type="cite"><span>define dso_local i32 @mm(i8*
nocapture readonly %a, i8* nocapture readonly %b)
local_unnamed_addr #1 {</span><br>
</blockquote>
<blockquote type="cite"><span>entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %call = tail call i32
@memcmp(i8* %a, i8* %b, i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %call</span><br>
</blockquote>
<blockquote type="cite"><span>}</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>After patch:</span><br>
</blockquote>
<blockquote type="cite"><span>define dso_local i32 @mm(i8*
nocapture readonly %a, i8* nocapture readonly %b)
local_unnamed_addr #1 {</span><br>
</blockquote>
<blockquote type="cite"><span>entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %call = tail call i32
@memcmp(i8* dereferenceable(16) %a, i8*
dereferenceable(16) %b, i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %call</span><br>
</blockquote>
<blockquote type="cite"><span>}</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Reviewers: jdoerfert, efriedma</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Reviewed By: jdoerfert</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Subscribers: javed.absar,
spatel, llvm-commits</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Tags: #llvm</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Differential Revision: <a
href="https://reviews.llvm.org/D66079"
moz-do-not-send="true">https://reviews.llvm.org/D66079</a></span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Added:</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/mem-deref-bytes.ll</span><br>
</blockquote>
<blockquote type="cite"><span>Modified:</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/include/llvm/Transforms/Utils/SimplifyLibCalls.h</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/ARM/strcmp.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/align-addr.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/memchr.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/memcmp-constant-fold.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/memcpy-from-global.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/memcpy-to-load.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/memcpy.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/memcpy_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/memmove_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/memset_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/objsize.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/sprintf-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/stpcpy_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/strcmp-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/strcmp-memcmp.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/strcpy_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/InstCombine/strncpy_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>
llvm/trunk/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/include/llvm/Transforms/Utils/SimplifyLibCalls.h</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SimplifyLibCalls.h?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SimplifyLibCalls.h?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/include/llvm/Transforms/Utils/SimplifyLibCalls.h
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/include/llvm/Transforms/Utils/SimplifyLibCalls.h
Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -167,9 +167,9 @@ private:</span><br>
</blockquote>
<blockquote type="cite"><span> Value
*optimizeMemCmp(CallInst *CI, IRBuilder<> &B);</span><br>
</blockquote>
<blockquote type="cite"><span> Value *optimizeBCmp(CallInst
*CI, IRBuilder<> &B);</span><br>
</blockquote>
<blockquote type="cite"><span> Value
*optimizeMemCmpBCmpCommon(CallInst *CI, IRBuilder<>
&B);</span><br>
</blockquote>
<blockquote type="cite"><span>- Value
*optimizeMemCpy(CallInst *CI, IRBuilder<> &B);</span><br>
</blockquote>
<blockquote type="cite"><span>- Value
*optimizeMemMove(CallInst *CI, IRBuilder<> &B);</span><br>
</blockquote>
<blockquote type="cite"><span>- Value
*optimizeMemSet(CallInst *CI, IRBuilder<> &B);</span><br>
</blockquote>
<blockquote type="cite"><span>+ Value
*optimizeMemCpy(CallInst *CI, IRBuilder<> &B,
bool isIntrinsic = false);</span><br>
</blockquote>
<blockquote type="cite"><span>+ Value
*optimizeMemMove(CallInst *CI, IRBuilder<> &B,
bool isIntrinsic = false);</span><br>
</blockquote>
<blockquote type="cite"><span>+ Value
*optimizeMemSet(CallInst *CI, IRBuilder<> &B,
bool isIntrinsic = false);</span><br>
</blockquote>
<blockquote type="cite"><span> Value
*optimizeRealloc(CallInst *CI, IRBuilder<> &B);</span><br>
</blockquote>
<blockquote type="cite"><span> Value
*optimizeWcslen(CallInst *CI, IRBuilder<> &B);</span><br>
</blockquote>
<blockquote type="cite"><span> // Wrapper for all
String/Memory Library Call Optimizations</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp Tue
Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -186,6 +186,20 @@ static bool
canTransformToMemCmp(CallIns</span><br>
</blockquote>
<blockquote type="cite"><span> return true;</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> +static void
annotateDereferenceableBytes(CallInst *CI,</span><br>
</blockquote>
<blockquote type="cite"><span>+
ArrayRef<unsigned>
ArgNos,</span><br>
</blockquote>
<blockquote type="cite"><span>+
uint64_t
DerefBytes) {</span><br>
</blockquote>
<blockquote type="cite"><span>+ for (unsigned ArgNo : ArgNos)
{</span><br>
</blockquote>
<blockquote type="cite"><span>+ if
(CI->getDereferenceableBytes(ArgNo +
AttributeList::FirstArgIndex) <</span><br>
</blockquote>
<blockquote type="cite"><span>+ DerefBytes) {</span><br>
</blockquote>
<blockquote type="cite"><span>+
CI->removeParamAttr(ArgNo,
Attribute::Dereferenceable);</span><br>
</blockquote>
<blockquote type="cite"><span>+
CI->removeParamAttr(ArgNo,
Attribute::DereferenceableOrNull);</span><br>
</blockquote>
<blockquote type="cite"><span>+
CI->addParamAttr(ArgNo,
Attribute::getWithDereferenceableBytes(</span><br>
</blockquote>
<blockquote type="cite"><span>+
CI->getContext(),
DerefBytes));</span><br>
</blockquote>
<blockquote type="cite"><span>+ }</span><br>
</blockquote>
<blockquote type="cite"><span>+ }</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>
//===----------------------------------------------------------------------===//</span><br>
</blockquote>
<blockquote type="cite"><span> // String and Memory Library
Call Optimizations</span><br>
</blockquote>
<blockquote type="cite"><span>
//===----------------------------------------------------------------------===//</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -765,9 +779,11 @@ Value
*LibCallSimplifier::optimizeMemChr</span><br>
</blockquote>
<blockquote type="cite"><span> ConstantInt *LenC =
dyn_cast<ConstantInt>(CI->getArgOperand(2));</span><br>
</blockquote>
<blockquote type="cite"><span> // memchr(x, y, 0) ->
null</span><br>
</blockquote>
<blockquote type="cite"><span>- if (LenC &&
LenC->isZero())</span><br>
</blockquote>
<blockquote type="cite"><span>- return
Constant::getNullValue(CI->getType());</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>+ if (LenC) {</span><br>
</blockquote>
<blockquote type="cite"><span>+ if (LenC->isZero())</span><br>
</blockquote>
<blockquote type="cite"><span>+ return
Constant::getNullValue(CI->getType());</span><br>
</blockquote>
<blockquote type="cite"><span>+
annotateDereferenceableBytes(CI, {0},
LenC->getZExtValue());</span><br>
</blockquote>
<blockquote type="cite"><span>+ }</span><br>
</blockquote>
<blockquote type="cite"><span> // From now on we need at
least constant length and string.</span><br>
</blockquote>
<blockquote type="cite"><span> StringRef Str;</span><br>
</blockquote>
<blockquote type="cite"><span> if (!LenC ||
!getConstantStringInfo(SrcStr, Str, 0,
/*TrimAtNul=*/false))</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -926,10 +942,12 @@ Value
*LibCallSimplifier::optimizeMemCmp</span><br>
</blockquote>
<blockquote type="cite"><span> return
Constant::getNullValue(CI->getType());</span><br>
</blockquote>
<blockquote type="cite"><span> // Handle constant
lengths.</span><br>
</blockquote>
<blockquote type="cite"><span>- if (ConstantInt *LenC =
dyn_cast<ConstantInt>(Size))</span><br>
</blockquote>
<blockquote type="cite"><span>+ if (ConstantInt *LenC =
dyn_cast<ConstantInt>(Size)) {</span><br>
</blockquote>
<blockquote type="cite"><span> if (Value *Res =
optimizeMemCmpConstantSize(CI, LHS, RHS,</span><br>
</blockquote>
<blockquote type="cite"><span>
LenC->getZExtValue(),
B, DL))</span><br>
</blockquote>
<blockquote type="cite"><span> return Res;</span><br>
</blockquote>
<blockquote type="cite"><span>+
annotateDereferenceableBytes(CI, {0, 1},
LenC->getZExtValue());</span><br>
</blockquote>
<blockquote type="cite"><span>+ }</span><br>
</blockquote>
<blockquote type="cite"><span> return nullptr;</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -955,18 +973,31 @@ Value
*LibCallSimplifier::optimizeBCmp(C</span><br>
</blockquote>
<blockquote type="cite"><span> return
optimizeMemCmpBCmpCommon(CI, B);</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -Value
*LibCallSimplifier::optimizeMemCpy(CallInst *CI,
IRBuilder<> &B) {</span><br>
</blockquote>
<blockquote type="cite"><span>+Value
*LibCallSimplifier::optimizeMemCpy(CallInst *CI,
IRBuilder<> &B,</span><br>
</blockquote>
<blockquote type="cite"><span>+
bool isIntrinsic)
{</span><br>
</blockquote>
<blockquote type="cite"><span>+ Value *Size =
CI->getArgOperand(2);</span><br>
</blockquote>
<blockquote type="cite"><span>+ if (ConstantInt *LenC =
dyn_cast<ConstantInt>(Size))</span><br>
</blockquote>
<blockquote type="cite"><span>+
annotateDereferenceableBytes(CI, {0, 1},
LenC->getZExtValue());</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+ if (isIntrinsic)</span><br>
</blockquote>
<blockquote type="cite"><span>+ return nullptr;</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span> // memcpy(x, y, n) ->
llvm.memcpy(align 1 x, align 1 y, n)</span><br>
</blockquote>
<blockquote type="cite"><span>-
B.CreateMemCpy(CI->getArgOperand(0), 1,
CI->getArgOperand(1), 1,</span><br>
</blockquote>
<blockquote type="cite"><span>-
CI->getArgOperand(2));</span><br>
</blockquote>
<blockquote type="cite"><span>+
B.CreateMemCpy(CI->getArgOperand(0), 1,
CI->getArgOperand(1), 1, Size);</span><br>
</blockquote>
<blockquote type="cite"><span> return
CI->getArgOperand(0);</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -Value
*LibCallSimplifier::optimizeMemMove(CallInst *CI,
IRBuilder<> &B) {</span><br>
</blockquote>
<blockquote type="cite"><span>+Value
*LibCallSimplifier::optimizeMemMove(CallInst *CI,
IRBuilder<> &B, bool isIntrinsic) {</span><br>
</blockquote>
<blockquote type="cite"><span>+ Value *Size =
CI->getArgOperand(2);</span><br>
</blockquote>
<blockquote type="cite"><span>+ if (ConstantInt *LenC =
dyn_cast<ConstantInt>(Size))</span><br>
</blockquote>
<blockquote type="cite"><span>+
annotateDereferenceableBytes(CI, {0, 1},
LenC->getZExtValue());</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+ if (isIntrinsic)</span><br>
</blockquote>
<blockquote type="cite"><span>+ return nullptr;</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span> // memmove(x, y, n) ->
llvm.memmove(align 1 x, align 1 y, n)</span><br>
</blockquote>
<blockquote type="cite"><span>-
B.CreateMemMove(CI->getArgOperand(0), 1,
CI->getArgOperand(1), 1,</span><br>
</blockquote>
<blockquote type="cite"><span>-
CI->getArgOperand(2));</span><br>
</blockquote>
<blockquote type="cite"><span>- return
CI->getArgOperand(0);</span><br>
</blockquote>
<blockquote type="cite"><span>+ B.CreateMemMove(
CI->getArgOperand(0), 1, CI->getArgOperand(1), 1,
Size);</span><br>
</blockquote>
<blockquote type="cite"><span>+ return
CI->getArgOperand(0);</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> /// Fold
memset[_chk](malloc(n), 0, n) --> calloc(1, n).</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1015,13 +1046,21 @@ Value
*LibCallSimplifier::foldMallocMems</span><br>
</blockquote>
<blockquote type="cite"><span> return Calloc;</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -Value
*LibCallSimplifier::optimizeMemSet(CallInst *CI,
IRBuilder<> &B) {</span><br>
</blockquote>
<blockquote type="cite"><span>+Value
*LibCallSimplifier::optimizeMemSet(CallInst *CI,
IRBuilder<> &B,</span><br>
</blockquote>
<blockquote type="cite"><span>+
bool isIntrinsic)
{</span><br>
</blockquote>
<blockquote type="cite"><span>+ Value *Size =
CI->getArgOperand(2);</span><br>
</blockquote>
<blockquote type="cite"><span>+ if (ConstantInt *LenC =
dyn_cast<ConstantInt>(Size))</span><br>
</blockquote>
<blockquote type="cite"><span>+
annotateDereferenceableBytes(CI, {0},
LenC->getZExtValue());</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+ if (isIntrinsic)</span><br>
</blockquote>
<blockquote type="cite"><span>+ return nullptr;</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span> if (auto *Calloc =
foldMallocMemset(CI, B))</span><br>
</blockquote>
<blockquote type="cite"><span> return Calloc;</span><br>
</blockquote>
<blockquote type="cite"><span> // memset(p, v, n) ->
llvm.memset(align 1 p, v, n)</span><br>
</blockquote>
<blockquote type="cite"><span> Value *Val =
B.CreateIntCast(CI->getArgOperand(1), B.getInt8Ty(),
false);</span><br>
</blockquote>
<blockquote type="cite"><span>-
B.CreateMemSet(CI->getArgOperand(0), Val,
CI->getArgOperand(2), 1);</span><br>
</blockquote>
<blockquote type="cite"><span>+
B.CreateMemSet(CI->getArgOperand(0), Val, Size, 1);</span><br>
</blockquote>
<blockquote type="cite"><span> return
CI->getArgOperand(0);</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> @@ -2710,6 +2749,12 @@ Value
*LibCallSimplifier::optimizeCall(C</span><br>
</blockquote>
<blockquote type="cite"><span> case Intrinsic::sqrt:</span><br>
</blockquote>
<blockquote type="cite"><span> return optimizeSqrt(CI,
Builder);</span><br>
</blockquote>
<blockquote type="cite"><span> // TODO: Use
foldMallocMemset() with memset intrinsic.</span><br>
</blockquote>
<blockquote type="cite"><span>+ case Intrinsic::memset:</span><br>
</blockquote>
<blockquote type="cite"><span>+ return optimizeMemSet(CI,
Builder, true);</span><br>
</blockquote>
<blockquote type="cite"><span>+ case Intrinsic::memcpy:</span><br>
</blockquote>
<blockquote type="cite"><span>+ return optimizeMemCpy(CI,
Builder, true);</span><br>
</blockquote>
<blockquote type="cite"><span>+ case Intrinsic::memmove:</span><br>
</blockquote>
<blockquote type="cite"><span>+ return
optimizeMemMove(CI, Builder, true);</span><br>
</blockquote>
<blockquote type="cite"><span> default:</span><br>
</blockquote>
<blockquote type="cite"><span> return nullptr;</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/memcpyopt.ll
Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -6,7 +6,7 @@ target
datalayout = "e-p:64:64:64"</span><br>
</blockquote>
<blockquote type="cite"><span> ; it has a TBAA tag which
declares that it is unrelated.</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: @foo</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: tail call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %p, i8* align 1 %q,
i64 16, i1 false), !tbaa !0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: tail call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(16)
%p, i8* align 1 dereferenceable(16) %q, i64 16, i1 false),
!tbaa !0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: store i8 2, i8*
%s, align 1, !tbaa [[TAGA:!.*]]</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> define void @foo(i8* nocapture
%p, i8* nocapture %q, i8* nocapture %s) nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/ARM/strcmp.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/ARM/strcmp.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/ARM/strcmp.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/ARM/strcmp.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/ARM/strcmp.ll Tue
Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test that the strcmp library
call simplifier works correctly.</span><br>
</blockquote>
<blockquote type="cite"><span> ; RUN: opt < %s
-instcombine -S | FileCheck %s</span><br>
</blockquote>
<blockquote type="cite"><span> @@ -13,10 +14,11 @@ declare
i32 @strcmp(i8*, i8*)</span><br>
</blockquote>
<blockquote type="cite"><span> ; strcmp("", x) -> -*x</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcscc i32
@test1(i8* %str2) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test1(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %strcmpload = load i8,
i8* %str</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %1 = zext i8
%strcmpload to i32</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %2 = sub nsw i32 0, %1</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 %2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[STRCMPLOAD:%.*]] = load i8, i8* [[STR2:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
zext i8 [[STRCMPLOAD]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP2:%.*]] =
sub nsw i32 0, [[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP2]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call arm_apcscc i32
@strcmp(i8* %str1, i8* %str2)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -27,9 +29,10 @@ define
arm_aapcscc i32 @test1(i8* %str2)</span><br>
</blockquote>
<blockquote type="cite"><span> ; strcmp(x, "") -> *x</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcscc i32
@test2(i8* %str1) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test2(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %strcmpload = load i8,
i8* %str</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %1 = zext i8
%strcmpload to i32</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[STRCMPLOAD:%.*]] = load i8, i8* [[STR1:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
zext i8 [[STRCMPLOAD]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str2 = getelementptr
inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call arm_aapcscc
i32 @strcmp(i8* %str1, i8* %str2)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -39,7 +42,8 @@ define
arm_aapcscc i32 @test2(i8* %str1)</span><br>
</blockquote>
<blockquote type="cite"><span> ; strcmp(x, y) -> cnst</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcscc i32
@test3() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test3(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 -1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 -1</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %str2 = getelementptr
inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -49,7 +53,8 @@ define
arm_aapcscc i32 @test3() {</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcscc i32
@test4() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test4(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 1</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %str2 = getelementptr
inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -61,8 +66,10 @@ define
arm_aapcscc i32 @test4() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; (This transform is rather
difficult to trigger in a useful manner)</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcscc i32
@test5(i1 %b) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test5(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %memcmp = call i32
@memcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]*
@hello, i32 0, i32 0), i8* %str2, i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 %memcmp</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[STR2:%.*]] =
select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x i8],
[5 x i8]* @hell, i32 0, i32 0), i8* getelementptr inbounds
([5 x i8], [5 x i8]* @bell, i32 0, i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(5) getelementptr
inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8*
dereferenceable(5) [[STR2]], i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[MEMCMP]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = getelementptr
inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -75,7 +82,8 @@ define
arm_aapcscc i32 @test5(i1 %b) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; strcmp(x,x) -> 0</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcscc i32
@test6(i8* %str) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test6(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call arm_aapcscc
i32 @strcmp(i8* %str, i8* %str)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %temp1</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -84,10 +92,11 @@ define
arm_aapcscc i32 @test6(i8* %str)</span><br>
</blockquote>
<blockquote type="cite"><span> ; strcmp("", x) -> -*x</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcs_vfpcc i32
@test1_vfp(i8* %str2) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test1_vfp(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %strcmpload = load i8,
i8* %str</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %1 = zext i8
%strcmpload to i32</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %2 = sub nsw i32 0, %1</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 %2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[STRCMPLOAD:%.*]] = load i8, i8* [[STR2:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
zext i8 [[STRCMPLOAD]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP2:%.*]] =
sub nsw i32 0, [[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP2]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call
arm_aapcs_vfpcc i32 @strcmp(i8* %str1, i8* %str2)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -98,9 +107,10 @@ define
arm_aapcs_vfpcc i32 @test1_vfp(i8</span><br>
</blockquote>
<blockquote type="cite"><span> ; strcmp(x, "") -> *x</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcs_vfpcc i32
@test2_vfp(i8* %str1) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test2_vfp(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %strcmpload = load i8,
i8* %str</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %1 = zext i8
%strcmpload to i32</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[STRCMPLOAD:%.*]] = load i8, i8* [[STR1:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
zext i8 [[STRCMPLOAD]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str2 = getelementptr
inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call
arm_aapcs_vfpcc i32 @strcmp(i8* %str1, i8* %str2)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -110,7 +120,8 @@ define
arm_aapcs_vfpcc i32 @test2_vfp(i8</span><br>
</blockquote>
<blockquote type="cite"><span> ; strcmp(x, y) -> cnst</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcs_vfpcc i32
@test3_vfp() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test3_vfp(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 -1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 -1</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %str2 = getelementptr
inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -120,7 +131,8 @@ define
arm_aapcs_vfpcc i32 @test3_vfp()</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcs_vfpcc i32
@test4_vfp() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test4_vfp(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 1</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %str2 = getelementptr
inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -132,8 +144,10 @@ define
arm_aapcs_vfpcc i32 @test4_vfp()</span><br>
</blockquote>
<blockquote type="cite"><span> ; (This transform is rather
difficult to trigger in a useful manner)</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcs_vfpcc i32
@test5_vfp(i1 %b) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test5_vfp(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %memcmp = call i32
@memcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]*
@hello, i32 0, i32 0), i8* %str2, i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 %memcmp</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[STR2:%.*]] =
select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x i8],
[5 x i8]* @hell, i32 0, i32 0), i8* getelementptr inbounds
([5 x i8], [5 x i8]* @bell, i32 0, i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(5) getelementptr
inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8*
dereferenceable(5) [[STR2]], i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[MEMCMP]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = getelementptr
inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -146,7 +160,8 @@ define
arm_aapcs_vfpcc i32 @test5_vfp(i1</span><br>
</blockquote>
<blockquote type="cite"><span> ; strcmp(x,x) -> 0</span><br>
</blockquote>
<blockquote type="cite"><span> define arm_aapcs_vfpcc i32
@test6_vfp(i8* %str) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test6_vfp(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call
arm_aapcs_vfpcc i32 @strcmp(i8* %str, i8* %str)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %temp1</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/align-addr.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/align-addr.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/align-addr.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/align-addr.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/align-addr.ll Tue
Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,13 +1,33 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; RUN: opt < %s
-instcombine -S | FileCheck %s</span><br>
</blockquote>
<blockquote type="cite"><span> target datalayout =
"E-p:64:64:64-p1:32:32:32-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"</span><br>
</blockquote>
<blockquote type="cite"><span> ; Instcombine should be able
to prove vector alignment in the</span><br>
</blockquote>
<blockquote type="cite"><span> ; presence of a few mild
address computation tricks.</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test0(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: align 16</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test0(i8* %b, i64
%n, i64 %u, i64 %y) nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test0(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[C:%.*]] =
ptrtoint i8* [[B:%.*]] to i64</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[D:%.*]] =
and i64 [[C]], -16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[E:%.*]] =
inttoptr i64 [[D]] to double*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[V:%.*]] =
shl i64 [[U:%.*]], 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[Z:%.*]] =
and i64 [[Y:%.*]], -2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[T1421:%.*]]
= icmp eq i64 [[N:%.*]], 0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: br i1
[[T1421]], label [[RETURN:%.*]], label [[BB:%.*]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK: bb:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[I:%.*]] =
phi i64 [ [[INDVAR_NEXT:%.*]], [[BB]] ], [ 20,
[[ENTRY:%.*]] ]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[J:%.*]] =
mul i64 [[I]], [[V]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[H:%.*]] =
add i64 [[J]], [[Z]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[T8:%.*]] =
getelementptr double, double* [[E]], i64 [[H]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[P:%.*]] =
bitcast double* [[T8]] to <2 x double>*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store <2 x
double> zeroinitializer, <2 x double>* [[P]],
align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[INDVAR_NEXT]] = add i64 [[I]], 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[EXITCOND:%.*]] = icmp eq i64 [[INDVAR_NEXT]], [[N]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: br i1
[[EXITCOND]], label [[RETURN]], label [[BB]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK: return:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %c = ptrtoint i8* %b to i64</span><br>
</blockquote>
<blockquote type="cite"><span> %d = and i64 %c, -16</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -35,24 +55,26 @@ return:</span><br>
</blockquote>
<blockquote type="cite"><span> ; When we see a unaligned load
from an insufficiently aligned global or</span><br>
</blockquote>
<blockquote type="cite"><span> ; alloca, increase the
alignment of the load, turning it into an aligned load.</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test1(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: tmp = load</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: GLOBAL{{.*}}align 16</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span> @GLOBAL = internal global [4 x
i32] zeroinitializer</span><br>
</blockquote>
<blockquote type="cite"><span> define <16 x i8>
@test1(<2 x i64> %x) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP:%.*]] =
load <16 x i8>, <16 x i8>* bitcast ([4 x i32]*
@GLOBAL to <16 x i8>*), align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret <16 x
i8> [[TMP]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp = load <16 x
i8>, <16 x i8>* bitcast ([4 x i32]* @GLOBAL to
<16 x i8>*), align 1</span><br>
</blockquote>
<blockquote type="cite"><span>- ret <16 x i8> %tmp</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp = load <16 x i8>,
<16 x i8>* bitcast ([4 x i32]* @GLOBAL to <16 x
i8>*), align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret <16 x i8> %tmp</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> @GLOBAL_as1 = internal
addrspace(1) global [4 x i32] zeroinitializer</span><br>
</blockquote>
<blockquote type="cite"><span> define <16 x i8>
@test1_as1(<2 x i64> %x) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test1_as1(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: tmp = load</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: GLOBAL_as1{{.*}}align
16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP:%.*]] =
load <16 x i8>, <16 x i8> addrspace(1)*
bitcast ([4 x i32] addrspace(1)* @GLOBAL_as1 to <16 x
i8> addrspace(1)*), align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret <16 x
i8> [[TMP]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %tmp = load <16 x i8>,
<16 x i8> addrspace(1)* bitcast ([4 x i32]
addrspace(1)* @GLOBAL_as1 to <16 x i8>
addrspace(1)*), align 1</span><br>
</blockquote>
<blockquote type="cite"><span> ret <16 x i8> %tmp</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -61,8 +83,9 @@ define <16
x i8> @test1_as1(<2 x i64> %x</span><br>
</blockquote>
<blockquote type="cite"><span> define <16 x i8>
@test1_as1_gep(<2 x i64> %x) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test1_as1_gep(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: tmp = load</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK:
GLOBAL_as1_gep{{.*}}align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP:%.*]] =
load <16 x i8>, <16 x i8> addrspace(1)*
bitcast (i32 addrspace(1)* getelementptr inbounds ([8 x
i32], [8 x i32] addrspace(1)* @GLOBAL_as1_gep, i32 0, i32
4) to <16 x i8> addrspace(1)*), align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret <16 x
i8> [[TMP]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %tmp = load <16 x i8>,
<16 x i8> addrspace(1)* bitcast (i32 addrspace(1)*
getelementptr ([8 x i32], [8 x i32] addrspace(1)*
@GLOBAL_as1_gep, i16 0, i16 4) to <16 x i8>
addrspace(1)*), align 1</span><br>
</blockquote>
<blockquote type="cite"><span> ret <16 x i8> %tmp</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -70,11 +93,12 @@ define
<16 x i8> @test1_as1_gep(<2 x i64</span><br>
</blockquote>
<blockquote type="cite"><span> ; When a load or store lacks
an explicit alignment, add one.</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test2(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: load double, double*
%p, align 8</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: store double %n,
double* %p, align 8</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span> define double @test2(double*
%p, double %n) nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[T:%.*]] =
load double, double* [[P:%.*]], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store double
[[N:%.*]], double* [[P]], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret double
[[T]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %t = load double, double* %p</span><br>
</blockquote>
<blockquote type="cite"><span> store double %n, double* %p</span><br>
</blockquote>
<blockquote type="cite"><span> ret double %t</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -89,9 +113,13 @@ declare void
@use(i8*)</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test3(%struct.s*
sret %a4) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; Check that the alignment is
bumped up the alignment of the sret type.</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[A4_CAST:%.*]] = bitcast %struct.s* [[A4:%.*]] to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* align 4 dereferenceable(16)
[[A4_CAST]], i8 0, i64 16, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@use(i8* [[A4_CAST]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %a4.cast = bitcast
%struct.s* %a4 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memset.p0i8.i64(i8* %a4.cast, i8 0, i64 16, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: call void
@llvm.memset.p0i8.i64(i8* align 4 %a4.cast, i8 0, i64 16,
i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @use(i8* %a4.cast)</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Added:
llvm/trunk/test/Transforms/InstCombine/mem-deref-bytes.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/mem-deref-bytes.ll?rev=368657&view=auto"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/mem-deref-bytes.ll?rev=368657&view=auto</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/mem-deref-bytes.ll
(added)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/mem-deref-bytes.ll
Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -0,0 +1,127 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span>+; RUN: opt -instcombine -S
< %s | FileCheck %s</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+declare i32 @memcmp(i8*
nocapture, i8* nocapture, i64)</span><br>
</blockquote>
<blockquote type="cite"><span>+declare i8* @memcpy(i8*
nocapture, i8* nocapture, i64)</span><br>
</blockquote>
<blockquote type="cite"><span>+declare i8* @memmove(i8*
nocapture, i8* nocapture, i64)</span><br>
</blockquote>
<blockquote type="cite"><span>+declare i8* @memset(i8*
nocapture, i8, i64)</span><br>
</blockquote>
<blockquote type="cite"><span>+declare i8* @memchr(i8*
nocapture, i32, i64)</span><br>
</blockquote>
<blockquote type="cite"><span>+declare void
@llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture,
i64, i1)</span><br>
</blockquote>
<blockquote type="cite"><span>+declare void
@llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture,
i64, i1)</span><br>
</blockquote>
<blockquote type="cite"><span>+declare void
@llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i32
@memcmp_const_size_set_deref(i8* nocapture readonly %d,
i8* nocapture readonly %s) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@memcmp_const_size_set_deref(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i32 @memcmp(i8* dereferenceable(16) [[D:%.*]],
i8* dereferenceable(16) [[S:%.*]], i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[CALL]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %call = tail call i32
@memcmp(i8* %d, i8* %s, i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i32 %call</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i32
@memcmp_const_size_update_deref(i8* nocapture readonly %d,
i8* nocapture readonly %s) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@memcmp_const_size_update_deref(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i32 @memcmp(i8* dereferenceable(16) [[D:%.*]],
i8* dereferenceable(16) [[S:%.*]], i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[CALL]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %call = tail call i32
@memcmp(i8* dereferenceable(4) %d, i8* dereferenceable(8)
%s, i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i32 %call</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i32
@memcmp_const_size_update_deref2(i8* nocapture readonly
%d, i8* nocapture readonly %s) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@memcmp_const_size_update_deref2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i32 @memcmp(i8* dereferenceable(16) [[D:%.*]],
i8* dereferenceable(16) [[S:%.*]], i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[CALL]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %call = tail call i32
@memcmp(i8* %d, i8* dereferenceable_or_null(8) %s, i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i32 %call</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i32
@memcmp_const_size_no_update_deref(i8* nocapture readonly
%d, i8* nocapture readonly %s) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@memcmp_const_size_no_update_deref(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i32 @memcmp(i8* dereferenceable(40) [[D:%.*]],
i8* dereferenceable(16) [[S:%.*]], i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[CALL]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %call = tail call i32
@memcmp(i8* dereferenceable(40) %d, i8* %s, i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i32 %call</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i32
@memcmp_const_size_no_update_deref2(i8* nocapture readonly
%d, i8* nocapture readonly %s) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@memcmp_const_size_no_update_deref2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i32 @memcmp(i8* dereferenceable(16) [[D:%.*]],
i8* dereferenceable(16) [[S:%.*]], i64 16)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[CALL]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %call = tail call i32
@memcmp(i8* dereferenceable_or_null(40) %d, i8* %s, i64
16)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i32 %call</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i32
@memcmp_nonconst_size(i8* nocapture readonly %d, i8*
nocapture readonly %s, i64 %n) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@memcmp_nonconst_size(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i32 @memcmp(i8* [[D:%.*]], i8* [[S:%.*]], i64
[[N:%.*]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[CALL]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %call = tail call i32
@memcmp(i8* %d, i8* %s, i64 %n)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i32 %call</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i8*
@memcpy_const_size_set_deref(i8* nocapture readonly %d,
i8* nocapture readonly %s) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@memcpy_const_size_set_deref(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(64)
[[D:%.*]], i8* align 1 dereferenceable(64) [[S:%.*]], i64
64, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8* [[D]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %call = tail call i8*
@memcpy(i8* %d, i8* %s, i64 64)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i8* %call</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i8*
@memmove_const_size_set_deref(i8* nocapture readonly %d,
i8* nocapture readonly %s) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@memmove_const_size_set_deref(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memmove.p0i8.p0i8.i64(i8* align 1
dereferenceable(64) [[D:%.*]], i8* align 1
dereferenceable(64) [[S:%.*]], i64 64, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8* [[D]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %call = tail call i8*
@memmove(i8* %d, i8* %s, i64 64)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i8* %call</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i8*
@memset_const_size_set_deref(i8* nocapture readonly %s, i8
%c) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@memset_const_size_set_deref(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* align 1 dereferenceable(64)
[[S:%.*]], i8 [[C:%.*]], i64 64, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8* [[S]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %call = tail call i8*
@memset(i8* %s, i8 %c, i64 64)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i8* %call</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i8*
@memchr_const_size_set_deref(i8* nocapture readonly %s,
i32 %c) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@memchr_const_size_set_deref(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i8* @memchr(i8* dereferenceable(64) [[S:%.*]],
i32 [[C:%.*]], i64 64)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[CALL]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %call = tail call i8*
@memchr(i8* %s, i32 %c, i64 64)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i8* %call</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i8*
@llvm_memcpy_const_size_set_deref(i8* nocapture readonly
%d, i8* nocapture readonly %s) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@llvm_memcpy_const_size_set_deref(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(16)
[[D:%.*]], i8* align 1 dereferenceable(16) [[S:%.*]], i64
16, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8* [[D]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %d, i8* align 1 %s,
i64 16, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i8* %d</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+define i8*
@llvm_memmove_const_size_set_deref(i8* nocapture readonly
%d, i8* nocapture readonly %s) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@llvm_memmove_const_size_set_deref(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memmove.p0i8.p0i8.i64(i8* align 1
dereferenceable(16) [[D:%.*]], i8* align 1
dereferenceable(16) [[S:%.*]], i64 16, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8* [[D]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ call void
@llvm.memmove.p0i8.p0i8.i64(i8* align 1 %d, i8* align 1
%s, i64 16, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i8* %d</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span>+define i8*
@llvm_memset_const_size_set_deref(i8* nocapture readonly
%s, i8 %c) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@llvm_memset_const_size_set_deref(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* align 1 dereferenceable(16)
[[S:%.*]], i8 [[C:%.*]], i64 16, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8* [[S]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ call void
@llvm.memset.p0i8.i64(i8* align 1 %s, i8 %c, i64 16, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret i8* %s</span><br>
</blockquote>
<blockquote type="cite"><span>+}</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/memchr.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memchr.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memchr.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/memchr.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/memchr.ll Tue Aug
13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -50,7 +50,7 @@ define void
@test3() {</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test4(i32 %chr)
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test4(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[DST:%.*]] =
call i8* @memchr(i8* getelementptr inbounds ([14 x i8],
[14 x i8]* @hello, i32 0, i32 0), i32 [[CHR:%.*]], i32 14)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[DST:%.*]] =
call i8* @memchr(i8* dereferenceable(14) getelementptr
inbounds ([14 x i8], [14 x i8]* @hello, i32 0, i32 0), i32
[[CHR:%.*]], i32 14)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: store i8*
[[DST]], i8** @chp, align 4</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -148,7 +148,7 @@ define i1
@test11(i32 %C) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; No 64 bits here</span><br>
</blockquote>
<blockquote type="cite"><span> define i1 @test12(i32 %C) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test12(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[DST:%.*]] =
call i8* @memchr(i8* getelementptr inbounds ([4 x i8], [4
x i8]* @spaces, i32 0, i32 0), i32 [[C:%.*]], i32 3)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[DST:%.*]] =
call i8* @memchr(i8* dereferenceable(3) getelementptr
inbounds ([4 x i8], [4 x i8]* @spaces, i32 0, i32 0), i32
[[C:%.*]], i32 3)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp ne i8* [[DST]], null</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i1
[[CMP]]</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -185,7 +185,7 @@ define i1
@test14(i32 %C) {</span><br>
</blockquote>
<blockquote type="cite"><span> define i1 @test15(i32 %C) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test15(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[DST:%.*]] =
call i8* @memchr(i8* getelementptr inbounds ([3 x i8], [3
x i8]* @negative, i32 0, i32 0), i32 [[C:%.*]], i32 3)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[DST:%.*]] =
call i8* @memchr(i8* dereferenceable(3) getelementptr
inbounds ([3 x i8], [3 x i8]* @negative, i32 0, i32 0),
i32 [[C:%.*]], i32 3)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp ne i8* [[DST]], null</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i1
[[CMP]]</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/memcmp-constant-fold.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memcmp-constant-fold.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memcmp-constant-fold.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/memcmp-constant-fold.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/memcmp-constant-fold.ll
Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; RUN: opt < %s
-instcombine -S -data-layout=e-n32 | FileCheck %s
--check-prefix=ALL --check-prefix=LE</span><br>
</blockquote>
<blockquote type="cite"><span> ; RUN: opt < %s
-instcombine -S -data-layout=E-n32 | FileCheck %s
--check-prefix=ALL --check-prefix=BE</span><br>
</blockquote>
<blockquote type="cite"><span> @@ -9,13 +10,13 @@ declare i32
@memcmp(i8*, i8*, i64)</span><br>
</blockquote>
<blockquote type="cite"><span> define i1
@memcmp_4bytes_unaligned_constant_i8(i8* align 4 %x) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; LE-LABEL:
@memcmp_4bytes_unaligned_constant_i8(</span><br>
</blockquote>
<blockquote type="cite"><span>-; LE-NEXT: [[TMP1:%.*]] =
bitcast i8* %x to i32*</span><br>
</blockquote>
<blockquote type="cite"><span>+; LE-NEXT: [[TMP1:%.*]] =
bitcast i8* [[X:%.*]] to i32*</span><br>
</blockquote>
<blockquote type="cite"><span> ; LE-NEXT: [[LHSV:%.*]] =
load i32, i32* [[TMP1]], align 4</span><br>
</blockquote>
<blockquote type="cite"><span> ; LE-NEXT: [[TMP2:%.*]] =
icmp eq i32 [[LHSV]], 16777216</span><br>
</blockquote>
<blockquote type="cite"><span> ; LE-NEXT: ret i1 [[TMP2]]</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span> ; BE-LABEL:
@memcmp_4bytes_unaligned_constant_i8(</span><br>
</blockquote>
<blockquote type="cite"><span>-; BE-NEXT: [[TMP1:%.*]] =
bitcast i8* %x to i32*</span><br>
</blockquote>
<blockquote type="cite"><span>+; BE-NEXT: [[TMP1:%.*]] =
bitcast i8* [[X:%.*]] to i32*</span><br>
</blockquote>
<blockquote type="cite"><span> ; BE-NEXT: [[LHSV:%.*]] =
load i32, i32* [[TMP1]], align 4</span><br>
</blockquote>
<blockquote type="cite"><span> ; BE-NEXT: [[TMP2:%.*]] =
icmp eq i32 [[LHSV]], 1</span><br>
</blockquote>
<blockquote type="cite"><span> ; BE-NEXT: ret i1 [[TMP2]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -32,13 +33,13 @@ define i1
@memcmp_4bytes_unaligned_const</span><br>
</blockquote>
<blockquote type="cite"><span> define i1
@memcmp_4bytes_unaligned_constant_i16(i8* align 4 %x) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; LE-LABEL:
@memcmp_4bytes_unaligned_constant_i16(</span><br>
</blockquote>
<blockquote type="cite"><span>-; LE-NEXT: [[TMP1:%.*]] =
bitcast i8* %x to i32*</span><br>
</blockquote>
<blockquote type="cite"><span>+; LE-NEXT: [[TMP1:%.*]] =
bitcast i8* [[X:%.*]] to i32*</span><br>
</blockquote>
<blockquote type="cite"><span> ; LE-NEXT: [[RHSV:%.*]] =
load i32, i32* [[TMP1]], align 4</span><br>
</blockquote>
<blockquote type="cite"><span> ; LE-NEXT: [[TMP2:%.*]] =
icmp eq i32 [[RHSV]], 131073</span><br>
</blockquote>
<blockquote type="cite"><span> ; LE-NEXT: ret i1 [[TMP2]]</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span> ; BE-LABEL:
@memcmp_4bytes_unaligned_constant_i16(</span><br>
</blockquote>
<blockquote type="cite"><span>-; BE-NEXT: [[TMP1:%.*]] =
bitcast i8* %x to i32*</span><br>
</blockquote>
<blockquote type="cite"><span>+; BE-NEXT: [[TMP1:%.*]] =
bitcast i8* [[X:%.*]] to i32*</span><br>
</blockquote>
<blockquote type="cite"><span> ; BE-NEXT: [[RHSV:%.*]] =
load i32, i32* [[TMP1]], align 4</span><br>
</blockquote>
<blockquote type="cite"><span> ; BE-NEXT: [[TMP2:%.*]] =
icmp eq i32 [[RHSV]], 65538</span><br>
</blockquote>
<blockquote type="cite"><span> ; BE-NEXT: ret i1 [[TMP2]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -54,7 +55,7 @@ define i1
@memcmp_4bytes_unaligned_const</span><br>
</blockquote>
<blockquote type="cite"><span> define i1
@memcmp_3bytes_aligned_constant_i32(i8* align 4 %x) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-LABEL:
@memcmp_3bytes_aligned_constant_i32(</span><br>
</blockquote>
<blockquote type="cite"><span>-; ALL-NEXT: [[CALL:%.*]] =
tail call i32 @memcmp(i8* bitcast (i32* getelementptr
inbounds ([2 x i32], [2 x i32]* @intbuf, i64 0, i64 1) to
i8*), i8* bitcast ([2 x i32]* @intbuf to i8*), i64 3)</span><br>
</blockquote>
<blockquote type="cite"><span>+; ALL-NEXT: [[CALL:%.*]] =
tail call i32 @memcmp(i8* dereferenceable(3) bitcast (i32*
getelementptr inbounds ([2 x i32], [2 x i32]* @intbuf, i64
0, i64 1) to i8*), i8* dereferenceable(3) bitcast ([2 x
i32]* @intbuf to i8*), i64 3)</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-NEXT: [[CMPEQ0:%.*]]
= icmp eq i32 [[CALL]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-NEXT: ret i1
[[CMPEQ0]]</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -67,7 +68,7 @@ define i1
@memcmp_3bytes_aligned_constan</span><br>
</blockquote>
<blockquote type="cite"><span> define i1
@memcmp_4bytes_one_unaligned_i8(i8* align 4 %x, i8* align
1 %y) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-LABEL:
@memcmp_4bytes_one_unaligned_i8(</span><br>
</blockquote>
<blockquote type="cite"><span>-; ALL-NEXT: [[CALL:%.*]] =
tail call i32 @memcmp(i8* %x, i8* %y, i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; ALL-NEXT: [[CALL:%.*]] =
tail call i32 @memcmp(i8* dereferenceable(4) [[X:%.*]],
i8* dereferenceable(4) [[Y:%.*]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-NEXT: [[CMPEQ0:%.*]]
= icmp eq i32 [[CALL]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-NEXT: ret i1
[[CMPEQ0]]</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/memcpy-from-global.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memcpy-from-global.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memcpy-from-global.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/memcpy-from-global.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/memcpy-from-global.ll
Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,39 +1,66 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; RUN: opt < %s
-instcombine -S | FileCheck %s</span><br>
</blockquote>
<blockquote type="cite"><span> target datalayout =
"E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"</span><br>
</blockquote>
<blockquote type="cite"><span> @C.0.1248 = internal constant
[128 x float] [ float -1.000000e+00, float -1.000000e+00,
float -1.000000e+00, float 0.000000e+00, float
-1.000000e+00, float -1.000000e+00, float 0.000000e+00,
float -1.000000e+00, float -1.000000e+00, float
-1.000000e+00, float 0.000000e+00, float 1.000000e+00,
float -1.000000e+00, float -1.000000e+00, float
1.000000e+00, float 0.000000e+00, float -1.000000e+00,
float 0.000000e+00, float -1.000000e+00, float
-1.000000e+00, float -1.000000e+00, float 0.000000e+00,
float -1.000000e+00, float 1.000000e+00, float
-1.000000e+00, float 0.000000e+00, float 1.000000e+00,
float -1.000000e+00, float -1.000000e+00, float
0.000000e+00, float 1.000000e+00, float 1.000000e+00,
float -1.000000e+00, float 1.000000e+00, float
-1.000000e+00, float 0.000000e+00, float -1.000000e+00,
float 1.000000e+00, float 0.000000e+00, float
-1.000000e+00, float -1.000000e+00, float 1.000000e+00,
float 0.000000e+00, float 1.000000e+00, float
-1.000000e+00, float 1.000000e+00, float 1.000000e+00,
float 0.000000e+00, float 0.000000e+00, float
-1.000000e+00, float -1.000000e+00, float -1.000000e+00,
float 0.000000e+00, float -1.000000e+00, float
-1.000000e+00, float 1.000000e+00, float 0.000000e+00,
float -1.000000e+00, float 1.000000e+00, float
-1.000000e+00, float 0.000000e+00, float -1.000000e+00,
float 1.000000e+00, float 1.000000e+00, float
1.000000e+00, float -1.000000e+00, float -1.000000e+00,
float 0.000000e+00, float 1.000000e+00, float
-1.000000e+00, float 0.000000e+00, float -1.000000e+00,
float 1.000000e+00, float -1.000000e+00, float
0.000000e+00, float 1.000000e+00, float 1.000000e+00,
float -1.000000e+00, float 1.000000e+00, float
0.000000e+00, float 1.000000e+00, float 0.000000e+00,
float -1.000000e+00, float -1.000000e+00, float
1.000000e+00, float 0.000000e+00, float -1.000000e+00,
float 1.000000e+00, float 1.000000e+00, float
0.000000e+00, float 1.000000e+00, float -1.000000e+00,
float 1.000000e+00, float 0.000000e+00, float
1.000000e+00, float 1.000000e+00, float 1.000000e+00,
float 1.000000e+00, float -1.000000e+00, float
0.000000e+00, float 1.000000e+00, float 1.000000e+00,
float 0.000000e+00, float -1.000000e+00, float
1.000000e+00, float 1.000000e+00, float 0.000000e+00,
float 1.000000e+00, float 1.000000e+00, float
1.000000e+00, float 1.000000e+00, float 0.000000e+00,
float 0.000000e+00, float 1.000000e+00, float
-1.000000e+00, float -1.000000e+00, float 0.000000e+00,
float 1.000000e+00, float -1.000000e+00, float
1.000000e+00, float 0.000000e+00, float 1.000000e+00,
float 1.000000e+00, float -1.000000e+00, float
0.000000e+00, float 1.000000e+00, float 1.000000e+00,
float 1.000000e+00 ], align 32 ; <[128 x
float]*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span> define float @test1(i32
%hash, float %x, float %y, float %z, float %w) {</span><br>
</blockquote>
<blockquote type="cite"><span>-entry:</span><br>
</blockquote>
<blockquote type="cite"><span>- %lookupTable = alloca [128
x float], align 16 ; <[128 x float]*>
[#uses=5]</span><br>
</blockquote>
<blockquote type="cite"><span>- %lookupTable1 = bitcast
[128 x float]* %lookupTable to i8* ; <i8*>
[#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 16 %lookupTable1, i8*
align 16 bitcast ([128 x float]* @C.0.1248 to i8*), i64
512, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test1(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NOT: alloca</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NOT: <a
href="mailto:call{{.*}}@llvm.memcpy"
moz-do-not-send="true">call{{.*}}@llvm.memcpy</a></span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp3 = shl i32 %hash, 2
; <i32> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp5 = and i32 %tmp3, 124
; <i32> [#uses=4]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp753 = getelementptr
[128 x float], [128 x float]* %lookupTable, i32 0, i32
%tmp5 ; <float*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp9 = load float, float*
%tmp753 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp11 = fmul float %tmp9,
%x ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp13 = fadd float %tmp11,
0.000000e+00 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp17.sum52 = or i32
%tmp5, 1 ; <i32> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp1851 = getelementptr
[128 x float], [128 x float]* %lookupTable, i32 0, i32
%tmp17.sum52 ; <float*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp19 = load float, float*
%tmp1851 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp21 = fmul float %tmp19,
%y ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp23 = fadd float %tmp21,
%tmp13 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp27.sum50 = or i32
%tmp5, 2 ; <i32> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp2849 = getelementptr
[128 x float], [128 x float]* %lookupTable, i32 0, i32
%tmp27.sum50 ; <float*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp29 = load float, float*
%tmp2849 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp31 = fmul float %tmp29,
%z ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp33 = fadd float %tmp31,
%tmp23 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp37.sum48 = or i32
%tmp5, 3 ; <i32> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp3847 = getelementptr
[128 x float], [128 x float]* %lookupTable, i32 0, i32
%tmp37.sum48 ; <float*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp39 = load float, float*
%tmp3847 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp41 = fmul float %tmp39,
%w ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- %tmp43 = fadd float %tmp41,
%tmp33 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>- ret float %tmp43</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP3:%.*]] =
shl i32 [[HASH:%.*]], 2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP5:%.*]] =
and i32 [[TMP3]], 124</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP0:%.*]] =
zext i32 [[TMP5]] to i64</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP753:%.*]]
= getelementptr [128 x float], [128 x float]* @C.0.1248,
i64 0, i64 [[TMP0]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP9:%.*]] =
load float, float* [[TMP753]], align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP11:%.*]]
= fmul float [[TMP9]], [[X:%.*]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP13:%.*]]
= fadd float [[TMP11]], 0.000000e+00</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[TMP17_SUM52:%.*]] = or i32 [[TMP5]], 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
zext i32 [[TMP17_SUM52]] to i64</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[TMP1851:%.*]] = getelementptr [128 x float], [128 x
float]* @C.0.1248, i64 0, i64 [[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP19:%.*]]
= load float, float* [[TMP1851]], align 4</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP21:%.*]]
= fmul float [[TMP19]], [[Y:%.*]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP23:%.*]]
= fadd float [[TMP21]], [[TMP13]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[TMP27_SUM50:%.*]] = or i32 [[TMP5]], 2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP2:%.*]] =
zext i32 [[TMP27_SUM50]] to i64</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[TMP2849:%.*]] = getelementptr [128 x float], [128 x
float]* @C.0.1248, i64 0, i64 [[TMP2]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP29:%.*]]
= load float, float* [[TMP2849]], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP31:%.*]]
= fmul float [[TMP29]], [[Z:%.*]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP33:%.*]]
= fadd float [[TMP31]], [[TMP23]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[TMP37_SUM48:%.*]] = or i32 [[TMP5]], 3</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP3:%.*]] =
zext i32 [[TMP37_SUM48]] to i64</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[TMP3847:%.*]] = getelementptr [128 x float], [128 x
float]* @C.0.1248, i64 0, i64 [[TMP3]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP39:%.*]]
= load float, float* [[TMP3847]], align 4</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP41:%.*]]
= fmul float [[TMP39]], [[W:%.*]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP43:%.*]]
= fadd float [[TMP41]], [[TMP33]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret float
[[TMP43]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+ %lookupTable = alloca [128 x
float], align 16 ; <[128 x float]*> [#uses=5]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %lookupTable1 = bitcast [128
x float]* %lookupTable to i8* ; <i8*>
[#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 16 %lookupTable1, i8*
align 16 bitcast ([128 x float]* @C.0.1248 to i8*), i64
512, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp3 = shl i32 %hash, 2
; <i32> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp5 = and i32 %tmp3, 124
; <i32> [#uses=4]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp753 = getelementptr [128
x float], [128 x float]* %lookupTable, i32 0, i32 %tmp5
; <float*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp9 = load float, float*
%tmp753 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp11 = fmul float %tmp9, %x
; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp13 = fadd float %tmp11,
0.000000e+00 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp17.sum52 = or i32 %tmp5,
1 ; <i32> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp1851 = getelementptr [128
x float], [128 x float]* %lookupTable, i32 0, i32
%tmp17.sum52 ; <float*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp19 = load float, float*
%tmp1851 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp21 = fmul float %tmp19,
%y ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp23 = fadd float %tmp21,
%tmp13 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp27.sum50 = or i32 %tmp5,
2 ; <i32> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp2849 = getelementptr [128
x float], [128 x float]* %lookupTable, i32 0, i32
%tmp27.sum50 ; <float*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp29 = load float, float*
%tmp2849 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp31 = fmul float %tmp29,
%z ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp33 = fadd float %tmp31,
%tmp23 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp37.sum48 = or i32 %tmp5,
3 ; <i32> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp3847 = getelementptr [128
x float], [128 x float]* %lookupTable, i32 0, i32
%tmp37.sum48 ; <float*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp39 = load float, float*
%tmp3847 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp41 = fmul float %tmp39,
%w ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ %tmp43 = fadd float %tmp41,
%tmp33 ; <float> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>+ ret float %tmp43</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> declare void
@llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture,
i64, i1) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -48,19 +75,22 @@ declare void
@llvm.memcpy.p1i8.p1i8.i64(</span><br>
</blockquote>
<blockquote type="cite"><span> @H = constant [2 x %U]
zeroinitializer, align 16</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test2() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[B1:%.*]] =
alloca [124 x i8], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[B1_SUB:%.*]]
= getelementptr inbounds [124 x i8], [124 x i8]* [[B1]],
i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8
dereferenceable(124) [[B1_SUB]], i8* align 16
dereferenceable(124) getelementptr inbounds (%T, %T* @G,
i64 0, i32 0), i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar(i8* nonnull [[B1_SUB]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %T</span><br>
</blockquote>
<blockquote type="cite"><span> %B = alloca %T</span><br>
</blockquote>
<blockquote type="cite"><span> %a = bitcast %T* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %b = bitcast %T* %B to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test2(</span><br>
</blockquote>
<blockquote type="cite"><span> ; %A alloca is deleted</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: alloca [124 x i8]</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: getelementptr
inbounds [124 x i8], [124 x i8]*</span><br>
</blockquote>
<blockquote type="cite"><span> ; use @G instead of %A</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 %{{.*}},
i8* align 16 getelementptr inbounds (%T, %T* @G, i64 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4
bitcast (%T* @G to i8*), i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %b, i8* align 4 %a,
i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar(i8* %b)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -68,19 +98,22 @@ define void
@test2() {</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test2_no_null_opt() #0 {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@test2_no_null_opt(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[B1:%.*]] =
alloca [124 x i8], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[B1_SUB:%.*]]
= getelementptr inbounds [124 x i8], [124 x i8]* [[B1]],
i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 8
dereferenceable(124) [[B1_SUB]], i8* align 16
dereferenceable(124) getelementptr inbounds (%T, %T* @G,
i64 0, i32 0), i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar(i8* [[B1_SUB]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %T</span><br>
</blockquote>
<blockquote type="cite"><span> %B = alloca %T</span><br>
</blockquote>
<blockquote type="cite"><span> %a = bitcast %T* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %b = bitcast %T* %B to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL:
@test2_no_null_opt(</span><br>
</blockquote>
<blockquote type="cite"><span> ; %A alloca is deleted</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: alloca [124 x i8]</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: getelementptr
inbounds [124 x i8], [124 x i8]*</span><br>
</blockquote>
<blockquote type="cite"><span> ; use @G instead of %A</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %{{.*}}, i8* align
16 getelementptr inbounds (%T, %T* @G, i64 0, i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4
bitcast (%T* @G to i8*), i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %b, i8* align 4 %a,
i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar(i8* %b)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -88,22 +121,25 @@ define void
@test2_no_null_opt() #0 {</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test2_addrspacecast() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@test2_addrspacecast(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[B1:%.*]] =
alloca [124 x i8], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[B1_SUB:%.*]]
= getelementptr inbounds [124 x i8], [124 x i8]* [[B1]],
i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[B:%.*]] =
addrspacecast i8* [[B1_SUB]] to i8 addrspace(1)*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* align 4
dereferenceable(124) [[B]], i8 addrspace(1)* align 4
dereferenceable(124) addrspacecast (i8* getelementptr
inbounds (%T, %T* @G, i64 0, i32 0) to i8 addrspace(1)*),
i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar_as1(i8 addrspace(1)* [[B]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %T</span><br>
</blockquote>
<blockquote type="cite"><span> %B = alloca %T</span><br>
</blockquote>
<blockquote type="cite"><span> %a = addrspacecast %T* %A to
i8 addrspace(1)*</span><br>
</blockquote>
<blockquote type="cite"><span> %b = addrspacecast %T* %B to
i8 addrspace(1)*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL:
@test2_addrspacecast(</span><br>
</blockquote>
<blockquote type="cite"><span> ; %A alloca is deleted</span><br>
</blockquote>
<blockquote type="cite"><span> ; This doesn't exactly match
what test2 does, because folding the type</span><br>
</blockquote>
<blockquote type="cite"><span> ; cast into the alloca doesn't
work for the addrspacecast yet.</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: alloca [124 x i8]</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: getelementptr</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: addrspacecast</span><br>
</blockquote>
<blockquote type="cite"><span> ; use @G instead of %A</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* align 4
%{{.*}},</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p1i8.p0i8.i64(i8 addrspace(1)* align 4 %a,
i8* align 4 bitcast (%T* @G to i8*), i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p1i8.p1i8.i64(i8 addrspace(1)* align 4 %b, i8
addrspace(1)* align 4 %a, i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar_as1(i8
addrspace(1)* %b)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -116,45 +152,53 @@ declare
void @bar_as1(i8 addrspace(1)*)</span><br>
</blockquote>
<blockquote type="cite"><span> ;; Should be able to
eliminate the alloca.</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test3() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32
0)) #2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %T</span><br>
</blockquote>
<blockquote type="cite"><span> %a = bitcast %T* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4
bitcast (%T* @G to i8*), i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar(i8* %a)
readonly</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL: @test3(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32
0))</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test3_addrspacecast() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@test3_addrspacecast(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32
0)) #2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %T</span><br>
</blockquote>
<blockquote type="cite"><span> %a = bitcast %T* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p1i8.i64(i8* align 4 %a, i8
addrspace(1)* align 4 addrspacecast (%T* @G to i8
addrspace(1)*), i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar(i8* %a)
readonly</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL:
@test3_addrspacecast(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@bar(i8* getelementptr inbounds (%T, %T* @G, i64 0, i32
0))</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test4() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test4(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@baz(i8* byval getelementptr inbounds (%T, %T* @G, i64 0,
i32 0))</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %T</span><br>
</blockquote>
<blockquote type="cite"><span> %a = bitcast %T* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4
bitcast (%T* @G to i8*), i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @baz(i8* byval %a)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL: @test4(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@baz(i8* byval getelementptr inbounds (%T, %T* @G, i64 0,
i32 0))</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> declare void
@llvm.lifetime.start.p0i8(i64, i8*)</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test5() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test5(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@baz(i8* byval getelementptr inbounds (%T, %T* @G, i64 0,
i32 0))</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %T</span><br>
</blockquote>
<blockquote type="cite"><span> %a = bitcast %T* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.lifetime.start.p0i8(i64 -1, i8* %a)</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4
bitcast (%T* @G to i8*), i64 124, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @baz(i8* byval %a)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL: @test5(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@baz(i8* byval getelementptr inbounds (%T, %T* @G, i64 0,
i32 0))</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> @@ -163,65 +207,81 @@ declare
void @baz(i8* byval)</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test6() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test6(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar(i8* bitcast ([2 x %U]* @H to i8*)) #2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %U, align 16</span><br>
</blockquote>
<blockquote type="cite"><span> %a = bitcast %U* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 16 %a, i8* align 16
bitcast ([2 x %U]* @H to i8*), i64 20, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar(i8* %a)
readonly</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL: @test6(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@bar(i8* bitcast ([2 x %U]* @H to i8*))</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test7() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test7(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar(i8* bitcast ([2 x %U]* @H to i8*)) #2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %U, align 16</span><br>
</blockquote>
<blockquote type="cite"><span> %a = bitcast %U* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4
bitcast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0,
i32 0) to i8*), i64 20, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar(i8* %a)
readonly</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL: @test7(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@bar(i8* bitcast ([2 x %U]* @H to i8*))</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test8() {</span><br>
</blockquote>
<blockquote type="cite"><span>- %A = alloca %U, align 16</span><br>
</blockquote>
<blockquote type="cite"><span>- %a = bitcast %U* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test8(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[AL:%.*]] =
alloca [[U:%.*]], align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[A:%.*]] =
bitcast %U* [[AL]] to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 16
dereferenceable(20) [[A]], i8* align 4 dereferenceable(20)
bitcast (%U* getelementptr inbounds ([2 x %U], [2 x %U]*
@H, i64 0, i64 1) to i8*), i64 20, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar(i8* nonnull [[A]]) #2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %al = alloca %U, align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+ %a = bitcast %U* %al to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4
bitcast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0,
i32 1) to i8*), i64 20, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar(i8* %a)
readonly</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL: @test8(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: llvm.memcpy</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: bar</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test8_addrspacecast() {</span><br>
</blockquote>
<blockquote type="cite"><span>- %A = alloca %U, align 16</span><br>
</blockquote>
<blockquote type="cite"><span>- %a = bitcast %U* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@test8_addrspacecast(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[AL:%.*]] =
alloca [[U:%.*]], align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[A:%.*]] =
bitcast %U* [[AL]] to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p1i8.i64(i8* nonnull align 16
dereferenceable(20) [[A]], i8 addrspace(1)* align 4
dereferenceable(20) addrspacecast (i8* bitcast (%U*
getelementptr inbounds ([2 x %U], [2 x %U]* @H, i64 0, i64
1) to i8*) to i8 addrspace(1)*), i64 20, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar(i8* nonnull [[A]]) #2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+ %Al = alloca %U, align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+ %a = bitcast %U* %Al to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p1i8.i64(i8* align 4 %a, i8
addrspace(1)* align 4 addrspacecast (%U* getelementptr ([2
x %U], [2 x %U]* @H, i64 0, i32 1) to i8 addrspace(1)*),
i64 20, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar(i8* %a)
readonly</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL:
@test8_addrspacecast(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: llvm.memcpy</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: bar</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test9() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test9(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2
x %U]* @H, i64 0, i64 1) to i8*)) #2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %U, align 4</span><br>
</blockquote>
<blockquote type="cite"><span> %a = bitcast %U* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a, i8* align 4
bitcast (%U* getelementptr ([2 x %U], [2 x %U]* @H, i64 0,
i32 1) to i8*), i64 20, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar(i8* %a)
readonly</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL: @test9(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2
x %U]* @H, i64 0, i64 1) to i8*))</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test9_addrspacecast() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@test9_addrspacecast(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2
x %U]* @H, i64 0, i64 1) to i8*)) #2</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %A = alloca %U, align 4</span><br>
</blockquote>
<blockquote type="cite"><span> %a = bitcast %U* %A to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p1i8.i64(i8* align 4 %a, i8
addrspace(1)* align 4 addrspacecast (%U* getelementptr ([2
x %U], [2 x %U]* @H, i64 0, i32 1) to i8 addrspace(1)*),
i64 20, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> call void @bar(i8* %a)
readonly</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL:
@test9_addrspacecast(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@bar(i8* bitcast (%U* getelementptr inbounds ([2 x %U], [2
x %U]* @H, i64 0, i64 1) to i8*))</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> @@ -231,8 +291,13 @@ define
void @test9_addrspacecast() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; Should not replace alloca
with global because of size mismatch.</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test9_small_global() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test9_small_global(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NOT: call void
@llvm.memcpy.p0i8.p0i8.i64({{.*}}@bbb,{{.*}}@_ZL3KKK,</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: alloca [1000000 x i8]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CC:%.*]] =
alloca [1000000 x i8], align 16</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[ARRAYDECAY:%.*]] = getelementptr inbounds [1000000 x
i8], [1000000 x i8]* [[CC]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 16
dereferenceable(3) [[ARRAYDECAY]], i8* align 16
dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x
i8]* @_ZL3KKK, i64 0, i64 0), i64 3, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 16
dereferenceable(1000000) getelementptr inbounds ([1000000
x i8], [1000000 x i8]* @bbb, i64 0, i64 0), i8* nonnull
align 16 dereferenceable(1000000) [[ARRAYDECAY]], i64
1000000, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %cc = alloca [1000000 x i8],
align 16</span><br>
</blockquote>
<blockquote type="cite"><span> %cc.0..sroa_idx =
getelementptr inbounds [1000000 x i8], [1000000 x i8]*
%cc, i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -245,8 +310,10 @@ entry:</span><br>
</blockquote>
<blockquote type="cite"><span> ; Should replace alloca with
global as they have exactly the same size.</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test10_same_global() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test10_same_global(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NOT: alloca</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: call void
@llvm.memcpy.p0i8.p0i8.i64({{.*}}@bbb,{{.*}}@_ZL3KKK,{{.*}},
i64 3,</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(3)
getelementptr inbounds ([1000000 x i8], [1000000 x i8]*
@bbb, i64 0, i64 0), i8* align 16 dereferenceable(3)
getelementptr inbounds ([3 x i8], [3 x i8]* @_ZL3KKK, i64
0, i64 0), i64 3, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %cc = alloca [3 x i8], align
1</span><br>
</blockquote>
<blockquote type="cite"><span> %cc.0..sroa_idx =
getelementptr inbounds [3 x i8], [3 x i8]* %cc, i64 0, i64
0</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/memcpy-to-load.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memcpy-to-load.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memcpy-to-load.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/memcpy-to-load.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/memcpy-to-load.ll
Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -34,7 +34,7 @@ define void
@copy_2_bytes(i8* %d, i8* %s</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@copy_3_bytes(i8* %d, i8* %s) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-LABEL: @copy_3_bytes(</span><br>
</blockquote>
<blockquote type="cite"><span>-; ALL-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 [[D:%.*]], i8*
align 1 [[S:%.*]], i32 3, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; ALL-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(3)
[[D:%.*]], i8* align 1 dereferenceable(3) [[S:%.*]], i32
3, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i32(i8* %d, i8* %s, i32 3, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -57,7 +57,7 @@ define void
@copy_4_bytes(i8* %d, i8* %s</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@copy_5_bytes(i8* %d, i8* %s) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-LABEL: @copy_5_bytes(</span><br>
</blockquote>
<blockquote type="cite"><span>-; ALL-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 [[D:%.*]], i8*
align 1 [[S:%.*]], i32 5, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; ALL-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(5)
[[D:%.*]], i8* align 1 dereferenceable(5) [[S:%.*]], i32
5, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i32(i8* %d, i8* %s, i32 5, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -78,7 +78,7 @@ define void
@copy_8_bytes(i8* %d, i8* %s</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@copy_16_bytes(i8* %d, i8* %s) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-LABEL: @copy_16_bytes(</span><br>
</blockquote>
<blockquote type="cite"><span>-; ALL-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 [[D:%.*]], i8*
align 1 [[S:%.*]], i32 16, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; ALL-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(16)
[[D:%.*]], i8* align 1 dereferenceable(16) [[S:%.*]], i32
16, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ; ALL-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.memcpy.p0i8.p0i8.i32(i8* %d, i8* %s, i32 16, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/memcpy.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memcpy.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memcpy.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/memcpy.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/memcpy.ll Tue Aug
13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -29,7 +29,7 @@ define void
@test2(i8* %a) {</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test3(i8* %d,
i8* %s) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test3(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: tail call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[D:%.*]], i8*
align 4 [[S:%.*]], i64 17179869184, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: tail call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4
dereferenceable(17179869184) [[D:%.*]], i8* align 4
dereferenceable(17179869184) [[S:%.*]], i64 17179869184,
i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span> tail call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %d, i8* align 4 %s,
i64 17179869184, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/memcpy_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memcpy_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memcpy_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/memcpy_chk-1.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/memcpy_chk-1.ll Tue
Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test lib call simplification
of __memcpy_chk calls with various values</span><br>
</blockquote>
<blockquote type="cite"><span> ; for dstlen and len.</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -17,22 +18,22 @@ target
datalayout = "e-p:64:64:64-i1:8:8</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify1()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4
dereferenceable(1824) bitcast (%struct.T1* @t1 to i8*),
i8* align 4 dereferenceable(1824) bitcast (%struct.T2* @t2
to i8*), i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
bitcast (%struct.T1* @t1 to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T1*
@t1 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %src = bitcast %struct.T2*
@t2 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 bitcast
(%struct.T1* @t1 to i8*), i8* align 4 bitcast (%struct.T2*
@t2 to i8*), i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* bitcast
(%struct.T1* @t1 to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memcpy_chk(i8* %dst, i8* %src, i64 1824, i64 1824)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify2()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4
dereferenceable(1824) bitcast (%struct.T1* @t1 to i8*),
i8* align 4 dereferenceable(1824) bitcast (%struct.T3* @t3
to i8*), i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
bitcast (%struct.T1* @t1 to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T1*
@t1 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %src = bitcast %struct.T3*
@t3 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 4 bitcast
(%struct.T1* @t1 to i8*), i8* align 4 bitcast (%struct.T3*
@t3 to i8*), i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* bitcast
(%struct.T1* @t1 to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memcpy_chk(i8* %dst, i8* %src, i64 1824, i64 2848)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -41,36 +42,35 @@ define i8*
@test_simplify2() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_no_simplify1() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__memcpy_chk(i8* bitcast (%struct.T3* @t3 to
i8*), i8* bitcast (%struct.T1* @t1 to i8*), i64 2848, i64
1824)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T3*
@t3 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %src = bitcast %struct.T1*
@t1 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %ret = call i8*
@__memcpy_chk(i8* bitcast (%struct.T3* @t3 to i8*), i8*
bitcast (%struct.T1* @t1 to i8*), i64 2848, i64 1824)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memcpy_chk(i8* %dst, i8* %src, i64 2848, i64 1824)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_no_simplify2() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__memcpy_chk(i8* bitcast (%struct.T1* @t1 to
i8*), i8* bitcast (%struct.T2* @t2 to i8*), i64 1024, i64
0)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T1*
@t1 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %src = bitcast %struct.T2*
@t2 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %ret = call i8*
@__memcpy_chk(i8* bitcast (%struct.T1* @t1 to i8*), i8*
bitcast (%struct.T2* @t2 to i8*), i64 1024, i64 0)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memcpy_chk(i8* %dst, i8* %src, i64 1024, i64 0)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_simplify_return_indcall(i8* ()* %alloc) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify_return_indcall(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[DST:%.*]] =
call i8* [[ALLOC:%.*]]()</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* align 1
dereferenceable(1824) [[DST]], i8* align 4
dereferenceable(1824) bitcast (%struct.T2* @t2 to i8*),
i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[DST]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %src = bitcast %struct.T2*
@t2 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %dst = call i8*
%alloc()</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = call i8* %alloc()</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memcpy_chk(i8* %dst, i8* %src, i64 1824, i64 1824)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %dst</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> </span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/memmove_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memmove_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memmove_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/memmove_chk-1.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/memmove_chk-1.ll
Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test lib call simplification
of __memmove_chk calls with various values</span><br>
</blockquote>
<blockquote type="cite"><span> ; for dstlen and len.</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -17,22 +18,24 @@ target
datalayout = "e-p:64:64:64-i1:8:8</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify1()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memmove.p0i8.p0i8.i64(i8* align 4
dereferenceable(1824) bitcast (%struct.T1* @t1 to i8*),
i8* align 4 dereferenceable(1824) bitcast (%struct.T2* @t2
to i8*), i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
bitcast (%struct.T1* @t1 to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T1*
@t1 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %src = bitcast %struct.T2*
@t2 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memmove.p0i8.p0i8.i64(i8* align 4 bitcast
(%struct.T1* @t1 to i8*), i8* align 4 bitcast (%struct.T2*
@t2 to i8*), i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* bitcast
(%struct.T1* @t1 to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memmove_chk(i8* %dst, i8* %src, i64 1824, i64 1824)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify2()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memmove.p0i8.p0i8.i64(i8* align 4
dereferenceable(1824) bitcast (%struct.T1* @t1 to i8*),
i8* align 4 dereferenceable(1824) bitcast (%struct.T3* @t3
to i8*), i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
bitcast (%struct.T1* @t1 to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T1*
@t1 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %src = bitcast %struct.T3*
@t3 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memmove.p0i8.p0i8.i64(i8* align 4 bitcast
(%struct.T1* @t1 to i8*), i8* align 4 bitcast (%struct.T3*
@t3 to i8*), i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* bitcast
(%struct.T1* @t1 to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memmove_chk(i8* %dst, i8* %src, i64 1824, i64 2848)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -41,22 +44,24 @@ define i8*
@test_simplify2() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_no_simplify1() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__memmove_chk(i8* bitcast (%struct.T3* @t3 to
i8*), i8* bitcast (%struct.T1* @t1 to i8*), i64 2848, i64
1824)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T3*
@t3 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %src = bitcast %struct.T1*
@t1 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %ret = call i8*
@__memmove_chk(i8* bitcast (%struct.T3* @t3 to i8*), i8*
bitcast (%struct.T1* @t1 to i8*), i64 2848, i64 1824)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memmove_chk(i8* %dst, i8* %src, i64 2848, i64 1824)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_no_simplify2() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__memmove_chk(i8* bitcast (%struct.T1* @t1 to
i8*), i8* bitcast (%struct.T2* @t2 to i8*), i64 1024, i64
0)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T1*
@t1 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %src = bitcast %struct.T2*
@t2 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %ret = call i8*
@__memmove_chk(i8* bitcast (%struct.T1* @t1 to i8*), i8*
bitcast (%struct.T2* @t2 to i8*), i64 1024, i64 0)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memmove_chk(i8* %dst, i8* %src, i64 1024, i64 0)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/memset_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memset_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/memset_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/memset_chk-1.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/memset_chk-1.ll Tue
Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test lib call simplification
of __memset_chk calls with various values</span><br>
</blockquote>
<blockquote type="cite"><span> ; for dstlen and len.</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -13,30 +14,33 @@ target
datalayout = "e-p:64:64:64-i1:8:8</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify1()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* align 4 dereferenceable(1824)
bitcast (%struct.T* @t to i8*), i8 0, i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
bitcast (%struct.T* @t to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T* @t
to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* align 4 bitcast (%struct.T* @t
to i8*), i8 0, i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* bitcast
(%struct.T* @t to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memset_chk(i8* %dst, i32 0, i64 1824, i64 1824)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify2()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* align 4 dereferenceable(1824)
bitcast (%struct.T* @t to i8*), i8 0, i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
bitcast (%struct.T* @t to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T* @t
to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* align 4 bitcast (%struct.T* @t
to i8*), i8 0, i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* bitcast
(%struct.T* @t to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memset_chk(i8* %dst, i32 0, i64 1824, i64 3648)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify3()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* align 4 dereferenceable(1824)
bitcast (%struct.T* @t to i8*), i8 0, i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
bitcast (%struct.T* @t to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T* @t
to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* align 4 bitcast (%struct.T* @t
to i8*), i8 0, i64 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* bitcast
(%struct.T* @t to i8*)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memset_chk(i8* %dst, i32 0, i64 1824, i64 -1)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -45,41 +49,55 @@ define i8*
@test_simplify3() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_no_simplify1() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__memset_chk(i8* bitcast (%struct.T* @t to i8*),
i32 0, i64 1824, i64 400)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T* @t
to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %ret = call i8*
@__memset_chk(i8* bitcast (%struct.T* @t to i8*), i32 0,
i64 1824, i64 400)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memset_chk(i8* %dst, i32 0, i64 1824, i64 400)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_no_simplify2() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__memset_chk(i8* bitcast (%struct.T* @t to i8*),
i32 0, i64 1824, i64 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = bitcast %struct.T* @t
to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %ret = call i8*
@__memset_chk(i8* bitcast (%struct.T* @t to i8*), i32 0,
i64 1824, i64 0)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__memset_chk(i8* %dst, i32 0, i64 1824, i64 0)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test that RAUW in
SimplifyLibCalls for __memset_chk generates valid IR</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test_rauw(i8* %a,
i8* %b, i8** %c) {</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL: test_rauw</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test_rauw(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL49:%.*]]
= call i64 @strlen(i8* [[A:%.*]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[ADD180:%.*]]
= add i64 [[CALL49]], 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[YO107:%.*]]
= call i64 @llvm.objectsize.i64.p0i8(i8* [[B:%.*]], i1
false, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL50:%.*]]
= call i8* @__memmove_chk(i8* [[B]], i8* [[A]], i64
[[ADD180]], i64 [[YO107]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[STRLEN:%.*]]
= call i64 @strlen(i8* [[B]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[STRCHR2:%.*]] = getelementptr i8, i8* [[B]], i64
[[STRLEN]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP0:%.*]] =
bitcast i8** [[C:%.*]] to i64*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[D1:%.*]] =
load i64, i64* [[TMP0]], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[SUB183:%.*]]
= ptrtoint i8* [[B]] to i64</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[SUB184:%.*]]
= sub i64 [[D1]], [[SUB183]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[ADD52_I_I:%.*]] = add nsw i64 [[SUB184]], 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* align 1 [[STRCHR2]], i8 0, i64
[[ADD52_I_I]], i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 4</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %call49 = call i64
@strlen(i8* %a)</span><br>
</blockquote>
<blockquote type="cite"><span> %add180 = add i64 %call49, 1</span><br>
</blockquote>
<blockquote type="cite"><span> %yo107 = call i64
@llvm.objectsize.i64.p0i8(i8* %b, i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> %call50 = call i8*
@__memmove_chk(i8* %b, i8* %a, i64 %add180, i64 %yo107)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %strlen = call i64
@strlen(i8* %b)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %strchr2 =
getelementptr i8, i8* %b, i64 %strlen</span><br>
</blockquote>
<blockquote type="cite"><span> %call51i = call i8*
@strrchr(i8* %b, i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span> %d = load i8*, i8** %c,
align 8</span><br>
</blockquote>
<blockquote type="cite"><span> %sub182 = ptrtoint i8* %d to
i64</span><br>
</blockquote>
<blockquote type="cite"><span> %sub183 = ptrtoint i8* %b to
i64</span><br>
</blockquote>
<blockquote type="cite"><span> %sub184 = sub i64 %sub182,
%sub183</span><br>
</blockquote>
<blockquote type="cite"><span> %add52.i.i = add nsw i64
%sub184, 1</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: call void
@llvm.memset.p0i8.i64(i8* align 1 %strchr2</span><br>
</blockquote>
<blockquote type="cite"><span> %call185 = call i8*
@__memset_chk(i8* %call51i, i32 0, i64 %add52.i.i, i64 -1)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 4</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -94,6 +112,20 @@ declare i8*
@__memset_chk(i8*, i32, i64,</span><br>
</blockquote>
<blockquote type="cite"><span> ; FIXME: memset(malloc(x), 0,
x) -> calloc(1, x)</span><br>
</blockquote>
<blockquote type="cite"><span> define float* @pr25892(i64
%size) #0 {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @pr25892(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i8* @malloc(i64 [[SIZE:%.*]]) #3</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i8* [[CALL]], null</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: br i1 [[CMP]],
label [[CLEANUP:%.*]], label [[IF_END:%.*]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK: if.end:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[BC:%.*]] =
bitcast i8* [[CALL]] to float*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL2:%.*]]
= tail call i64 @llvm.objectsize.i64.p0i8(i8* nonnull
[[CALL]], i1 false, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL3:%.*]]
= tail call i8* @__memset_chk(i8* nonnull [[CALL]], i32 0,
i64 [[SIZE]], i64 [[CALL2]]) #3</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: br label
[[CLEANUP]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK: cleanup:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[RETVAL_0:%.*]] = phi float* [ [[BC]], [[IF_END]] ], [
null, [[ENTRY:%.*]] ]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret float*
[[RETVAL_0]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %call = tail call i8*
@malloc(i64 %size) #1</span><br>
</blockquote>
<blockquote type="cite"><span> %cmp = icmp eq i8* %call,
null</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -107,19 +139,6 @@ cleanup:</span><br>
</blockquote>
<blockquote type="cite"><span> %retval.0 = phi float* [
%bc, %if.end ], [ null, %entry ]</span><br>
</blockquote>
<blockquote type="cite"><span> ret float* %retval.0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @pr25892(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %call = tail
call i8* @malloc(i64 %size)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %cmp = icmp eq
i8* %call, null</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: br i1 %cmp,
label %cleanup, label %if.end</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: if.end:</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %bc = bitcast
i8* %call to float*</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %call2 = tail
call i64 @llvm.objectsize.i64.p0i8(i8* nonnull %call, i1
false, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %call3 = tail
call i8* @__memset_chk(i8* nonnull %call, i32 0, i64
%size, i64 %call2)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: br label
%cleanup</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: cleanup:</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %retval.0 =
phi float* [ %bc, %if.end ], [ null, %entry ]</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret float*
%retval.0</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> declare noalias i8*
@malloc(i64) #1</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/objsize.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/objsize.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/objsize.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/objsize.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/objsize.ll Tue Aug
13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test a pile of objectsize
bounds checking.</span><br>
</blockquote>
<blockquote type="cite"><span> ; RUN: opt < %s
-instcombine -S | FileCheck %s</span><br>
</blockquote>
<blockquote type="cite"><span> ; We need target data to get
the sizes of the arrays and structures.</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -7,18 +8,27 @@ target
datalayout = "e-p:32:32:32-i1:8:8</span><br>
</blockquote>
<blockquote type="cite"><span> @.str = private constant [8 x
i8] c"abcdefg\00" ; <[8 x i8]*></span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @foo() nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @foo(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i32 60</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 60</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60
x i8], [60 x i8]* @a, i32 0, i32 0), i1 false, i1 false,
i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @bar() nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @bar(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RETVAL:%.*]]
= alloca i8*, align 4</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: br i1 true,
label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK: cond.true:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP0:%.*]] =
load i8*, i8** [[RETVAL]], align 4</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[TMP0]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK: cond.false:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8* undef</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %retval = alloca i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %0 = call i32
@llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60
x i8], [60 x i8]* @a, i32 0, i32 0), i1 false, i1 false,
i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> %cmp = icmp ne i32 %0, -1</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: br i1 true</span><br>
</blockquote>
<blockquote type="cite"><span> br i1 %cmp, label
%cond.true, label %cond.false</span><br>
</blockquote>
<blockquote type="cite"><span> cond.true:</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -32,7 +42,8 @@ cond.false:</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @f() nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @f(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p0i8(i8* getelementptr ([60 x i8],
[60 x i8]* @a, i32 1, i32 0), i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -41,7 +52,10 @@ define i32
@f() nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span> define i1 @baz() nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @baz(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: objectsize</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
tail call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr
inbounds ([0 x i8], [0 x i8]* @window, i32 0, i32 0), i1
false, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP2:%.*]] =
icmp eq i32 [[TMP1]], -1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i1
[[TMP2]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = tail call i32
@llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([0 x
i8], [0 x i8]* @window, i32 0, i32 0), i1 false, i1 false,
i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> %2 = icmp eq i32 %1, -1</span><br>
</blockquote>
<blockquote type="cite"><span> ret i1 %2</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -49,7 +63,15 @@ define i1
@baz() nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test1(i8* %q,
i32 %x) nounwind noinline {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test1(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: objectsize.i32.p0i8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP0:%.*]] =
call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr
inbounds ([0 x i8], [0 x i8]* @window, i32 0, i32 10), i1
false, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
icmp eq i32 [[TMP0]], -1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: br i1
[[TMP1]], label %"47", label %"46"</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK: "46":</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: unreachable</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK: "47":</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: unreachable</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %0 = call i32
@llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([0 x
i8], [0 x i8]* @window, i32 0, i32 10), i1 false, i1
false, i1 false) ; <i64> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = icmp eq i32 %0, -1
; <i1> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -66,7 +88,8 @@ entry:</span><br>
</blockquote>
<blockquote type="cite"><span> 101, i32 102, i32 103, i32
0], align 4</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test2() nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test2(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i32 34</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 34</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p0i8(i8* getelementptr (i8, i8*
bitcast ([9 x i32]* @.str5 to i8*), i32 2), i1 false, i1
false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -84,6 +107,14 @@ declare i8*
@__inline_memcpy_chk(i8*, i8</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test3()
nounwind {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: br i1 undef,
label [[BB11:%.*]], label [[BB12:%.*]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK: bb11:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: unreachable</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK: bb12:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP0:%.*]] =
call i8* @__inline_memcpy_chk(i8* bitcast (float*
getelementptr inbounds ([480 x float], [480 x float]*
@array, i32 0, i32 1) to i8*), i8* undef, i32 512) #3</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: unreachable</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> br i1 undef, label %bb11,
label %bb12</span><br>
</blockquote>
<blockquote type="cite"><span> @@ -92,14 +123,12 @@ bb11:</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = bitcast float* %0 to
i8* ; <i8*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span> %2 = call i32
@llvm.objectsize.i32.p0i8(i8* %1, i1 false, i1 false, i1
false) ; <i32> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span> %3 = call i8*
@__memcpy_chk(i8* undef, i8* undef, i32 512, i32 %2)
nounwind ; <i8*> [#uses=0]</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: unreachable</span><br>
</blockquote>
<blockquote type="cite"><span> unreachable</span><br>
</blockquote>
<blockquote type="cite"><span> bb12:</span><br>
</blockquote>
<blockquote type="cite"><span> %4 = getelementptr inbounds
float, float* getelementptr inbounds ([480 x float], [480
x float]* @array, i32 0, i32 128), i32 -127 ;
<float*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span> %5 = bitcast float* %4 to
i8* ; <i8*> [#uses=1]</span><br>
</blockquote>
<blockquote type="cite"><span> %6 = call i8*
@__inline_memcpy_chk(i8* %5, i8* undef, i32 512) nounwind
inlinehint ; <i8*> [#uses=0]</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: @__inline_memcpy_chk</span><br>
</blockquote>
<blockquote type="cite"><span> unreachable</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> @@ -109,12 +138,18 @@ bb12:</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test4(i8** %esc)
nounwind ssp {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test4(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP0:%.*]] =
alloca [[STRUCT_DATA:%.*]], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
bitcast %struct.data* [[TMP0]] to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i32(i8* nonnull align 8
dereferenceable(1824) [[TMP1]], i8 0, i32 1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP2:%.*]] =
bitcast i8** [[ESC:%.*]] to %struct.data**</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store
%struct.data* [[TMP0]], %struct.data** [[TMP2]], align 4</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %0 = alloca %struct.data,
align 8</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = bitcast %struct.data*
%0 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %2 = call i32
@llvm.objectsize.i32.p0i8(i8* %1, i1 false, i1 false, i1
false) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NOT: @llvm.objectsize</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK:
@llvm.memset.p0i8.i32(i8* nonnull align 8 %1, i8 0, i32
1824, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> %3 = call i8*
@__memset_chk(i8* %1, i32 0, i32 1824, i32 %2) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> store i8* %1, i8** %esc</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -125,24 +160,32 @@ entry:</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test5(i32 %n)
nounwind ssp {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test5(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP0:%.*]] =
tail call noalias i8* @malloc(i32 20) #0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
load i8*, i8** @s, align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(10)
[[TMP0]], i8* align 1 dereferenceable(10) [[TMP1]], i32
10, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[TMP0]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %0 = tail call noalias i8*
@malloc(i32 20) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = tail call i32
@llvm.objectsize.i32.p0i8(i8* %0, i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> %2 = load i8*, i8** @s,
align 8</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NOT: @llvm.objectsize</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK:
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %0, i8* align 1 %1,
i32 10, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> %3 = tail call i8*
@__memcpy_chk(i8* %0, i8* %2, i32 10, i32 %1) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %0</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void @test6(i32 %n)
nounwind ssp {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test6(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP0:%.*]] =
tail call noalias i8* @malloc(i32 20) #0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
load i8*, i8** @s, align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP2:%.*]] =
tail call i8* @__memcpy_chk(i8* [[TMP0]], i8* [[TMP1]],
i32 30, i32 20) #0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry:</span><br>
</blockquote>
<blockquote type="cite"><span> %0 = tail call noalias i8*
@malloc(i32 20) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = tail call i32
@llvm.objectsize.i32.p0i8(i8* %0, i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> %2 = load i8*, i8** @s,
align 8</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NOT: @llvm.objectsize</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: @__memcpy_chk(i8* %0,
i8* %1, i32 30, i32 20)</span><br>
</blockquote>
<blockquote type="cite"><span> %3 = tail call i8*
@__memcpy_chk(i8* %0, i8* %2, i32 30, i32 %1) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -153,11 +196,14 @@ declare
noalias i8* @malloc(i32) nounwin</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test7(i8** %esc)
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test7(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[ALLOC:%.*]]
= call noalias i8* @malloc(i32 48) #0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8*
[[ALLOC]], i8** [[ESC:%.*]], align 4</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 32</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %alloc = call noalias i8*
@malloc(i32 48) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> store i8* %alloc, i8** %esc</span><br>
</blockquote>
<blockquote type="cite"><span> %gep = getelementptr
inbounds i8, i8* %alloc, i32 16</span><br>
</blockquote>
<blockquote type="cite"><span> %objsize = call i32
@llvm.objectsize.i32.p0i8(i8* %gep, i1 false, i1 false, i1
false) nounwind readonly</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 32</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %objsize</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> @@ -165,67 +211,86 @@ declare
noalias i8* @calloc(i32, i32) no</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test8(i8** %esc)
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test8(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[ALLOC:%.*]]
= call noalias i8* @calloc(i32 5, i32 7) #0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8*
[[ALLOC]], i8** [[ESC:%.*]], align 4</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 30</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %alloc = call noalias i8*
@calloc(i32 5, i32 7) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> store i8* %alloc, i8** %esc</span><br>
</blockquote>
<blockquote type="cite"><span> %gep = getelementptr
inbounds i8, i8* %alloc, i32 5</span><br>
</blockquote>
<blockquote type="cite"><span> %objsize = call i32
@llvm.objectsize.i32.p0i8(i8* %gep, i1 false, i1 false, i1
false) nounwind readonly</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 30</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %objsize</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> declare noalias i8*
@strdup(i8* nocapture) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> declare noalias i8*
@strndup(i8* nocapture, i32) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test9(</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test9(i8** %esc) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test9(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i8* @strdup(i8* getelementptr inbounds ([8 x
i8], [8 x i8]* @.str, i32 0, i32 0)) #0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8*
[[CALL]], i8** [[ESC:%.*]], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 8</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %call = tail call i8*
@strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]*
@.str, i64 0, i64 0)) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> store i8* %call, i8** %esc,
align 8</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = tail call i32
@llvm.objectsize.i32.p0i8(i8* %call, i1 true, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 8</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test10(</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test10(i8** %esc)
{</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test10(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i8* @strndup(i8* getelementptr inbounds ([8 x
i8], [8 x i8]* @.str, i32 0, i32 0), i32 3) #0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8*
[[CALL]], i8** [[ESC:%.*]], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 4</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %call = tail call i8*
@strndup(i8* getelementptr inbounds ([8 x i8], [8 x i8]*
@.str, i64 0, i64 0), i32 3) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> store i8* %call, i8** %esc,
align 8</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = tail call i32
@llvm.objectsize.i32.p0i8(i8* %call, i1 true, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 4</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test11(</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test11(i8** %esc)
{</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test11(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i8* @strndup(i8* getelementptr inbounds ([8 x
i8], [8 x i8]* @.str, i32 0, i32 0), i32 7) #0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8*
[[CALL]], i8** [[ESC:%.*]], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 8</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %call = tail call i8*
@strndup(i8* getelementptr inbounds ([8 x i8], [8 x i8]*
@.str, i64 0, i64 0), i32 7) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> store i8* %call, i8** %esc,
align 8</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = tail call i32
@llvm.objectsize.i32.p0i8(i8* %call, i1 true, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 8</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test12(</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test12(i8** %esc)
{</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test12(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i8* @strndup(i8* getelementptr inbounds ([8 x
i8], [8 x i8]* @.str, i32 0, i32 0), i32 8) #0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8*
[[CALL]], i8** [[ESC:%.*]], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 8</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %call = tail call i8*
@strndup(i8* getelementptr inbounds ([8 x i8], [8 x i8]*
@.str, i64 0, i64 0), i32 8) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> store i8* %call, i8** %esc,
align 8</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = tail call i32
@llvm.objectsize.i32.p0i8(i8* %call, i1 true, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 8</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test13(</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test13(i8** %esc)
{</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test13(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[CALL:%.*]] =
tail call i8* @strndup(i8* getelementptr inbounds ([8 x
i8], [8 x i8]* @.str, i32 0, i32 0), i32 57) #0</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8*
[[CALL]], i8** [[ESC:%.*]], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 8</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %call = tail call i8*
@strndup(i8* getelementptr inbounds ([8 x i8], [8 x i8]*
@.str, i64 0, i64 0), i32 57) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span> store i8* %call, i8** %esc,
align 8</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = tail call i32
@llvm.objectsize.i32.p0i8(i8* %call, i1 true, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 8</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> @globalalias = internal
alias [60 x i8], [60 x i8]* @a</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test18(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i32 60</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test18() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test18(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 60</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %bc = bitcast [60 x i8]*
@globalalias to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p0i8(i8* %bc, i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -233,71 +298,87 @@ define i32
@test18() {</span><br>
</blockquote>
<blockquote type="cite"><span> @globalalias2 = weak alias
[60 x i8], [60 x i8]* @a</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test19(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: llvm.objectsize</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test19() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test19(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr
inbounds ([60 x i8], [60 x i8]* @globalalias2, i32 0, i32
0), i1 false, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %bc = bitcast [60 x i8]*
@globalalias2 to i8*</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p0i8(i8* %bc, i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test20(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test20() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test20(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p0i8(i8* null, i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test21(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test21() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test21(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p0i8(i8* null, i1 true, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test22(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: llvm.objectsize</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test22() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test22(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i32 @llvm.objectsize.i32.p0i8(i8* null, i1 false, i1
true, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p0i8(i8* null, i1 false, i1 true, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test23(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: llvm.objectsize</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test23() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test23(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i32 @llvm.objectsize.i32.p0i8(i8* null, i1 true, i1
true, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p0i8(i8* null, i1 true, i1 true, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> ; 1 is an arbitrary non-zero
address space.</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-LABEL: @test24(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: llvm.objectsize</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test24() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test24(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)* null,
i1 false, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p1i8(i8 addrspace(1)* null, i1 false,</span><br>
</blockquote>
<blockquote type="cite"><span>-
i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>+ i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test25(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: llvm.objectsize</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test25() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test25(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)* null,
i1 true, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p1i8(i8 addrspace(1)* null, i1 true,</span><br>
</blockquote>
<blockquote type="cite"><span>-
i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>+ i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test26(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: llvm.objectsize</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test26() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test26(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)* null,
i1 false, i1 true, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p1i8(i8 addrspace(1)* null, i1 false,</span><br>
</blockquote>
<blockquote type="cite"><span>-
i1 true, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>+ i1 true, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @test27(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: llvm.objectsize</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test27() {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test27(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i32 @llvm.objectsize.i32.p1i8(i8 addrspace(1)* null,
i1 true, i1 true, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %1 = call i32
@llvm.objectsize.i32.p1i8(i8 addrspace(1)* null, i1 true,</span><br>
</blockquote>
<blockquote type="cite"><span>-
i1 true, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span>+ i1 true, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/sprintf-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/sprintf-1.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/sprintf-1.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/sprintf-1.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/sprintf-1.ll Tue
Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test that the sprintf
library call simplifier works correctly.</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span> ; RUN: opt < %s
-instcombine -S | FileCheck %s</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -20,81 +21,125 @@ declare i32
@sprintf(i8*, i8*, ...)</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test_simplify1(i8* %dst) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(13)
[[DST:%.*]], i8* align 1 dereferenceable(13) getelementptr
inbounds ([13 x i8], [13 x i8]* @hello_world, i32 0, i32
0), i32 13, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-LABEL:
@test_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: call
void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1
dereferenceable(13) [[DST:%.*]], i8* align 1
dereferenceable(13) getelementptr inbounds ([13 x i8], [13
x i8]* @hello_world, i32 0, i32 0), i32 13, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: ret
void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %fmt = getelementptr [13 x
i8], [13 x i8]* @hello_world, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> call i32 (i8*, i8*, ...)
@sprintf(i8* %dst, i8* %fmt)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %dst, i8* align 1
getelementptr inbounds ([13 x i8], [13 x i8]*
@hello_world, i32 0, i32 0), i32 13, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test_simplify2(i8* %dst) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8 0,
i8* [[DST:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-LABEL:
@test_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: store
i8 0, i8* [[DST:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: ret
void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %fmt = getelementptr [1 x
i8], [1 x i8]* @null, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> call i32 (i8*, i8*, ...)
@sprintf(i8* %dst, i8* %fmt)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: store i8 0, i8*
%dst, align 1</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test_simplify3(i8* %dst) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8 0,
i8* [[DST:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-LABEL:
@test_simplify3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: store
i8 0, i8* [[DST:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: ret
void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %fmt = getelementptr [7 x
i8], [7 x i8]* @null_hello, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> call i32 (i8*, i8*, ...)
@sprintf(i8* %dst, i8* %fmt)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: store i8 0, i8*
%dst, align 1</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> ; Check sprintf(dst, "%c",
chr) -> *(i8*)dst = chr; *((i8*)dst + 1) = 0.</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test_simplify4(i8* %dst) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify4(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8 104,
i8* [[DST:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[NUL:%.*]] =
getelementptr i8, i8* [[DST]], i32 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: store i8 0,
i8* [[NUL]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-LABEL:
@test_simplify4(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: store
i8 104, i8* [[DST:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT:
[[NUL:%.*]] = getelementptr i8, i8* [[DST]], i32 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: store
i8 0, i8* [[NUL]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: ret
void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %fmt = getelementptr [3 x
i8], [3 x i8]* @percent_c, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> call i32 (i8*, i8*, ...)
@sprintf(i8* %dst, i8* %fmt, i8 104)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: store i8 104, i8*
%dst, align 1</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT:
[[NUL:%[a-z0-9]+]] = getelementptr i8, i8* %dst, i32 1</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: store i8 0, i8*
[[NUL]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> ; Check sprintf(dst, "%s",
str) -> llvm.memcpy(dest, str, strlen(str) + 1, 1).</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test_simplify5(i8* %dst, i8* %str) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify5(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[STRLEN:%.*]]
= call i32 @strlen(i8* [[STR:%.*]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[LENINC:%.*]]
= add i32 [[STRLEN]], 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 [[DST:%.*]], i8*
align 1 [[STR]], i32 [[LENINC]], i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-LABEL:
@test_simplify5(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT:
[[STRLEN:%.*]] = call i32 @strlen(i8* [[STR:%.*]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT:
[[LENINC:%.*]] = add i32 [[STRLEN]], 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: call
void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 [[DST:%.*]],
i8* align 1 [[STR]], i32 [[LENINC]], i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: ret
void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %fmt = getelementptr [3 x
i8], [3 x i8]* @percent_s, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> call i32 (i8*, i8*, ...)
@sprintf(i8* %dst, i8* %fmt, i8* %str)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT:
[[STRLEN:%[a-z0-9]+]] = call i32 @strlen(i8* %str)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT:
[[LENINC:%[a-z0-9]+]] = add i32 [[STRLEN]], 1</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %dst, i8* align 1
%str, i32 [[LENINC]], i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> ; Check sprintf(dst, format,
...) -> siprintf(str, format, ...) if no floating.</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test_simplify6(i8* %dst) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @test_simplify6(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i32 (i8*, i8*, ...) @sprintf(i8* [[DST:%.*]], i8*
getelementptr inbounds ([3 x i8], [3 x i8]* @percent_d,
i32 0, i32 0), i32 187)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-IPRINTF-LABEL:
@test_simplify6(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT:
[[TMP1:%.*]] = call i32 (i8*, i8*, ...) @siprintf(i8*
[[DST:%.*]], i8* getelementptr inbounds ([3 x i8], [3 x
i8]* @percent_d, i32 0, i32 0), i32 187)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: ret
void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %fmt = getelementptr [3 x
i8], [3 x i8]* @percent_d, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> call i32 (i8*, i8*, ...)
@sprintf(i8* %dst, i8* %fmt, i32 187)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-IPRINTF-NEXT: call i32
(i8*, i8*, ...) @siprintf(i8* %dst, i8* getelementptr
inbounds ([3 x i8], [3 x i8]* @percent_d, i32 0, i32 0),
i32 187)</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-IPRINTF-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test_no_simplify1(i8* %dst) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL:
@test_no_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i32 (i8*, i8*, ...) @sprintf(i8* [[DST:%.*]], i8*
getelementptr inbounds ([3 x i8], [3 x i8]* @percent_f,
i32 0, i32 0), double 1.870000e+00)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-IPRINTF-LABEL:
@test_no_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT:
[[TMP1:%.*]] = call i32 (i8*, i8*, ...) @sprintf(i8*
[[DST:%.*]], i8* getelementptr inbounds ([3 x i8], [3 x
i8]* @percent_f, i32 0, i32 0), double 1.870000e+00)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: ret
void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %fmt = getelementptr [3 x
i8], [3 x i8]* @percent_f, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> call i32 (i8*, i8*, ...)
@sprintf(i8* %dst, i8* %fmt, double 1.87)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-IPRINTF-NEXT: call i32
(i8*, i8*, ...) @sprintf(i8* %dst, i8* getelementptr
inbounds ([3 x i8], [3 x i8]* @percent_f, i32 0, i32 0),
double 1.870000e+00)</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-IPRINTF-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void
@test_no_simplify2(i8* %dst, i8* %fmt, double %d) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i32 (i8*, i8*, ...) @sprintf(i8* [[DST:%.*]], i8*
[[FMT:%.*]], double [[D:%.*]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-LABEL:
@test_no_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT:
[[TMP1:%.*]] = call i32 (i8*, i8*, ...) @sprintf(i8*
[[DST:%.*]], i8* [[FMT:%.*]], double [[D:%.*]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-IPRINTF-NEXT: ret
void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> call i32 (i8*, i8*, ...)
@sprintf(i8* %dst, i8* %fmt, double %d)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call i32 (i8*,
i8*, ...) @sprintf(i8* %dst, i8* %fmt, double %d)</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/stpcpy_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/stpcpy_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/stpcpy_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/stpcpy_chk-1.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/stpcpy_chk-1.ll Tue
Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test lib call simplification
of __stpcpy_chk calls with various values</span><br>
</blockquote>
<blockquote type="cite"><span> ; for src, dst, and slen.</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -13,33 +14,36 @@ target
datalayout = "e-p:32:32:32-i1:8:8</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify1()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(12)
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0), i8* align 1 dereferenceable(12) getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 11)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8*
align 1 getelementptr inbounds ([12 x i8], [12 x i8]*
@.str, i32 0, i32 0), i32 12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 11)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__stpcpy_chk(i8* %dst, i8* %src, i32 60)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify2()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(12)
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0), i8* align 1 dereferenceable(12) getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 11)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8*
align 1 getelementptr inbounds ([12 x i8], [12 x i8]*
@.str, i32 0, i32 0), i32 12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 11)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__stpcpy_chk(i8* %dst, i8* %src, i32 12)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify3()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(12)
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0), i8* align 1 dereferenceable(12) getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 11)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8*
align 1 getelementptr inbounds ([12 x i8], [12 x i8]*
@.str, i32 0, i32 0), i32 12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 11)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__stpcpy_chk(i8* %dst, i8* %src, i32 -1)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -48,11 +52,12 @@ define i8*
@test_simplify3() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify4()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify4(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[STPCPY:%.*]]
= call i8* @stpcpy(i8* getelementptr inbounds ([60 x i8],
[60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds
([60 x i8], [60 x i8]* @b, i32 0, i32 0))</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[STPCPY]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %stpcpy = call
i8* @stpcpy(i8* getelementptr inbounds ([60 x i8], [60 x
i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @b, i32 0, i32 0))</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %stpcpy</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__stpcpy_chk(i8* %dst, i8* %src, i32 -1)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -61,12 +66,13 @@ define i8*
@test_simplify4() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify5()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify5(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[LEN:%.*]] =
call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1
false, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i8* @__memcpy_chk(i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
12, i32 [[LEN]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 11)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %len = call i32
@llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60
x i8], [60 x i8]* @a, i32 0, i32 0), i1 false, i1 false,
i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %1 = call i8*
@__memcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x
i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x
i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 %len)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 11)</span><br>
</blockquote>
<blockquote type="cite"><span> %len = call i32
@llvm.objectsize.i32.p0i8(i8* %dst, i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__stpcpy_chk(i8* %dst, i8* %src, i32 %len)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -76,11 +82,12 @@ define i8*
@test_simplify5() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify6()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify6(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[STRLEN:%.*]]
= call i32 @strlen(i8* getelementptr inbounds ([60 x i8],
[60 x i8]* @a, i32 0, i32 0))</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0,
i32 [[STRLEN]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %strlen = call
i32 @strlen(i8* getelementptr inbounds ([60 x i8], [60 x
i8]* @a, i32 0, i32 0))</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %1 =
getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0,
i32 %strlen</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %1</span><br>
</blockquote>
<blockquote type="cite"><span> %len = call i32
@llvm.objectsize.i32.p0i8(i8* %dst, i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__stpcpy_chk(i8* %dst, i8* %dst, i32 %len)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -90,11 +97,12 @@ define i8*
@test_simplify6() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_no_simplify1() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__stpcpy_chk(i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr
inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0), i32 8)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %ret = call i8*
@__stpcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x
i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @b, i32 0, i32 0), i32 8)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__stpcpy_chk(i8* %dst, i8* %src, i32 8)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/strcmp-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/strcmp-1.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/strcmp-1.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/strcmp-1.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/strcmp-1.ll Tue Aug
13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test that the strcmp library
call simplifier works correctly.</span><br>
</blockquote>
<blockquote type="cite"><span> ; RUN: opt < %s
-instcombine -S | FileCheck %s --check-prefix=NOBCMP</span><br>
</blockquote>
<blockquote type="cite"><span> ; RUN: opt < %s
-instcombine -mtriple=unknown-unknown-linux-gnu -S |
FileCheck %s --check-prefix=BCMP</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -18,7 +19,18 @@ define i32
@test1(i8* %str2) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: %1 = zext i8
%strcmpload to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: %2 = sub nsw i32 0,
%1</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: ret i32 %2</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-LABEL: @test1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT:
[[STRCMPLOAD:%.*]] = load i8, i8* [[STR2:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: [[TMP1:%.*]]
= zext i8 [[STRCMPLOAD]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: [[TMP2:%.*]]
= sub nsw i32 0, [[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: ret i32
[[TMP2]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-LABEL: @test1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT:
[[STRCMPLOAD:%.*]] = load i8, i8* [[STR2:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: [[TMP1:%.*]] =
zext i8 [[STRCMPLOAD]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: [[TMP2:%.*]] =
sub nsw i32 0, [[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: ret i32
[[TMP2]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call i32
@strcmp(i8* %str1, i8* %str2)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %temp1</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -31,7 +43,16 @@ define i32
@test2(i8* %str1) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: %strcmpload = load
i8, i8* %str</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: %1 = zext i8
%strcmpload to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: ret i32 %1</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-LABEL: @test2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT:
[[STRCMPLOAD:%.*]] = load i8, i8* [[STR1:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: [[TMP1:%.*]]
= zext i8 [[STRCMPLOAD]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-LABEL: @test2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT:
[[STRCMPLOAD:%.*]] = load i8, i8* [[STR1:%.*]], align 1</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: [[TMP1:%.*]] =
zext i8 [[STRCMPLOAD]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: ret i32
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str2 = getelementptr
inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call i32
@strcmp(i8* %str1, i8* %str2)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %temp1</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -41,7 +62,12 @@ define i32
@test2(i8* %str1) {</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test3() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test3(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: ret i32 -1</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-LABEL: @test3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: ret i32 -1</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-LABEL: @test3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: ret i32 -1</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %str2 = getelementptr
inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call i32
@strcmp(i8* %str1, i8* %str2)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -51,7 +77,12 @@ define i32
@test3() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test4() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test4(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: ret i32 1</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-LABEL: @test4(</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: ret i32 1</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-LABEL: @test4(</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: ret i32 1</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %str2 = getelementptr
inbounds [1 x i8], [1 x i8]* @null, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call i32
@strcmp(i8* %str1, i8* %str2)</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -64,7 +95,16 @@ define i32
@test5(i1 %b) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test5(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: %memcmp = call i32
@memcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]*
@hello, i32 0, i32 0), i8* %str2, i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: ret i32 %memcmp</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-LABEL: @test5(</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: [[STR2:%.*]]
= select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x
i8], [5 x i8]* @hell, i32 0, i32 0), i8* getelementptr
inbounds ([5 x i8], [5 x i8]* @bell, i32 0, i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT:
[[MEMCMP:%.*]] = call i32 @memcmp(i8*
dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x
i8]* @hello, i32 0, i32 0), i8* dereferenceable(5)
[[STR2]], i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: ret i32
[[MEMCMP]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-LABEL: @test5(</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: [[STR2:%.*]] =
select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x i8],
[5 x i8]* @hell, i32 0, i32 0), i8* getelementptr inbounds
([5 x i8], [5 x i8]* @bell, i32 0, i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(5) getelementptr
inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8*
dereferenceable(5) [[STR2]], i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: ret i32
[[MEMCMP]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = getelementptr
inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp2 = getelementptr
inbounds [5 x i8], [5 x i8]* @bell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -77,22 +117,31 @@ define i32
@test5(i1 %b) {</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @test6(i8* %str) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @test6(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>-</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-LABEL: @test6(</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-LABEL: @test6(</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: ret i32 0</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = call i32
@strcmp(i8* %str, i8* %str)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i32 %temp1</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> ; strcmp(x, y) == 0 ->
bcmp(x, y, <known length>)</span><br>
</blockquote>
<blockquote type="cite"><span> define i1 @test7(i1 %b) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-LABEL: @test7(</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: [[STR2:%.*]]
= select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x
i8], [5 x i8]* @hell, i32 0, i32 0), i8* getelementptr
inbounds ([5 x i8], [5 x i8]* @bell, i32 0, i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT:
[[MEMCMP:%.*]] = call i32 @memcmp(i8*
dereferenceable(5) getelementptr inbounds ([6 x i8], [6 x
i8]* @hello, i32 0, i32 0), i8* dereferenceable(5)
[[STR2]], i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: [[RES:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOBCMP-NEXT: ret i1
[[RES]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> ; BCMP-LABEL: @test7(</span><br>
</blockquote>
<blockquote type="cite"><span>-; BCMP: %bcmp = call i32
@bcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]*
@hello, i32 0, i32 0), i8* %str2, i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span>-; BCMP: %res = icmp eq i32
%bcmp, 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; BCMP: ret i1 %res</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: [[STR2:%.*]] =
select i1 [[B:%.*]], i8* getelementptr inbounds ([5 x i8],
[5 x i8]* @hell, i32 0, i32 0), i8* getelementptr inbounds
([5 x i8], [5 x i8]* @bell, i32 0, i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: [[BCMP:%.*]] =
call i32 @bcmp(i8* dereferenceable(5) getelementptr
inbounds ([6 x i8], [6 x i8]* @hello, i32 0, i32 0), i8*
dereferenceable(5) [[STR2]], i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: [[RES:%.*]] =
icmp eq i32 [[BCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span>+; BCMP-NEXT: ret i1 [[RES]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> -; NOBCMP-LABEL: @test7(</span><br>
</blockquote>
<blockquote type="cite"><span>-; NOBCMP: %memcmp = call i32
@memcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]*
@hello, i32 0, i32 0), i8* %str2, i32 5)</span><br>
</blockquote>
<blockquote type="cite"><span>-; NOBCMP: %res = icmp eq i32
%memcmp, 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; NOBCMP: ret i1 %res</span><br>
</blockquote>
<blockquote type="cite"><span> %str1 = getelementptr
inbounds [6 x i8], [6 x i8]* @hello, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %temp1 = getelementptr
inbounds [5 x i8], [5 x i8]* @hell, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/strcmp-memcmp.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/strcmp-memcmp.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/strcmp-memcmp.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/strcmp-memcmp.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/strcmp-memcmp.ll
Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -11,7 +11,7 @@ declare void
@use(i32)</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @strcmp_memcmp([12
x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL: @strcmp_memcmp(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0,
i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(4)
[[STRING]], i8* dereferenceable(4) getelementptr inbounds
([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -28,7 +28,7 @@ declare i32
@strcmp(i8* nocapture, i8* n</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @strcmp_memcmp2([12
x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strcmp_memcmp2(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* getelementptr inbounds ([4 x i8],
[4 x i8]* @key, i64 0, i64 0), i8* nonnull [[STRING]], i64
4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(4) getelementptr
inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*
nonnull dereferenceable(4) [[STRING]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -43,7 +43,7 @@ define i32
@strcmp_memcmp2([12 x i8]* de</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @strcmp_memcmp3([12
x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strcmp_memcmp3(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0,
i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(4)
[[STRING]], i8* dereferenceable(4) getelementptr inbounds
([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp ne i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -58,7 +58,7 @@ define i32
@strcmp_memcmp3([12 x i8]* de</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @strcmp_memcmp4([12
x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strcmp_memcmp4(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* getelementptr inbounds ([4 x i8],
[4 x i8]* @key, i64 0, i64 0), i8* nonnull [[STRING]], i64
4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(4) getelementptr
inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*
nonnull dereferenceable(4) [[STRING]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp ne i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -73,7 +73,7 @@ define i32
@strcmp_memcmp4([12 x i8]* de</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @strcmp_memcmp5([5
x i8]* dereferenceable (5) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strcmp_memcmp5(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [5 x i8], [5 x
i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0,
i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(4)
[[STRING]], i8* dereferenceable(4) getelementptr inbounds
([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -88,7 +88,7 @@ define i32
@strcmp_memcmp5([5 x i8]* der</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @strcmp_memcmp6([12
x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strcmp_memcmp6(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0,
i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(4)
[[STRING]], i8* dereferenceable(4) getelementptr inbounds
([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp sgt i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -103,7 +103,7 @@ define i32
@strcmp_memcmp6([12 x i8]* de</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @strcmp_memcmp7([12
x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strcmp_memcmp7(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* getelementptr inbounds ([4 x i8],
[4 x i8]* @key, i64 0, i64 0), i8* nonnull [[STRING]], i64
4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(4) getelementptr
inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*
nonnull dereferenceable(4) [[STRING]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[MEMCMP_LOBIT:%.*]] = lshr i32 [[MEMCMP]], 31</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[MEMCMP_LOBIT]]</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -117,7 +117,7 @@ define i32
@strcmp_memcmp7([12 x i8]* de</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @strcmp_memcmp8([4
x i8]* dereferenceable (4) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strcmp_memcmp8(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [4 x i8], [4 x
i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0,
i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(4)
[[STRING]], i8* dereferenceable(4) getelementptr inbounds
([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -132,7 +132,7 @@ define i32
@strcmp_memcmp8([4 x i8]* der</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @strcmp_memcmp9([12
x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strcmp_memcmp9(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([8 x i8], [8 x i8]* @abc, i64 0,
i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(4)
[[STRING]], i8* dereferenceable(4) getelementptr inbounds
([8 x i8], [8 x i8]* @abc, i64 0, i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -148,7 +148,7 @@ define i32
@strcmp_memcmp9([12 x i8]* de</span><br>
</blockquote>
<blockquote type="cite"><span> define i32 @strncmp_memcmp([12
x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0,
i64 0), i64 2)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(2)
[[STRING]], i8* dereferenceable(2) getelementptr inbounds
([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 2)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -165,7 +165,7 @@ declare i32
@strncmp(i8* nocapture, i8*</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp2([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp2(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0,
i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(4)
[[STRING]], i8* dereferenceable(4) getelementptr inbounds
([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp ne i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -180,7 +180,7 @@ define i32
@strncmp_memcmp2([12 x i8]* d</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp3([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp3(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* getelementptr inbounds ([4 x i8],
[4 x i8]* @key, i64 0, i64 0), i8* nonnull [[STRING]], i64
4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(4) getelementptr
inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*
nonnull dereferenceable(4) [[STRING]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -195,7 +195,7 @@ define i32
@strncmp_memcmp3([12 x i8]* d</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp4([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp4(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0,
i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(4)
[[STRING]], i8* dereferenceable(4) getelementptr inbounds
([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -210,7 +210,7 @@ define i32
@strncmp_memcmp4([12 x i8]* d</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp5([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp5(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* getelementptr inbounds ([4 x i8],
[4 x i8]* @key, i64 0, i64 0), i8* nonnull [[STRING]], i64
4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(4) getelementptr
inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*
nonnull dereferenceable(4) [[STRING]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -226,7 +226,7 @@ define i32
@strncmp_memcmp5([12 x i8]* d</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp6([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp6(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* getelementptr inbounds ([4 x i8],
[4 x i8]* @key, i64 0, i64 0), i8* nonnull [[STRING]], i64
4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(4) getelementptr
inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*
nonnull dereferenceable(4) [[STRING]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp ne i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -241,7 +241,7 @@ define i32
@strncmp_memcmp6([12 x i8]* d</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp7([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp7(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0,
i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(4)
[[STRING]], i8* dereferenceable(4) getelementptr inbounds
([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -256,7 +256,7 @@ define i32
@strncmp_memcmp7([12 x i8]* d</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp8([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp8(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0,
i64 0), i64 3)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(3)
[[STRING]], i8* dereferenceable(3) getelementptr inbounds
([4 x i8], [4 x i8]* @key, i64 0, i64 0), i64 3)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -271,7 +271,7 @@ define i32
@strncmp_memcmp8([12 x i8]* d</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp9([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp9(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* getelementptr inbounds ([4 x i8],
[4 x i8]* @key, i64 0, i64 0), i8* nonnull [[STRING]], i64
4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(4) getelementptr
inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*
nonnull dereferenceable(4) [[STRING]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp sgt i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -286,7 +286,7 @@ define i32
@strncmp_memcmp9([12 x i8]* d</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp10([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp10(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* getelementptr inbounds ([4 x i8],
[4 x i8]* @key, i64 0, i64 0), i8* nonnull [[STRING]], i64
4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(4) getelementptr
inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*
nonnull dereferenceable(4) [[STRING]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[MEMCMP_LOBIT:%.*]] = lshr i32 [[MEMCMP]], 31</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[MEMCMP_LOBIT]]</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -300,7 +300,7 @@ define i32
@strncmp_memcmp10([12 x i8]*</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp11([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp11(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* getelementptr inbounds ([4 x i8],
[4 x i8]* @key, i64 0, i64 0), i8* nonnull [[STRING]], i64
4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(4) getelementptr
inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*
nonnull dereferenceable(4) [[STRING]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -315,7 +315,7 @@ define i32
@strncmp_memcmp11([12 x i8]*</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp12([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp12(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* getelementptr inbounds ([4 x i8],
[4 x i8]* @key, i64 0, i64 0), i8* nonnull [[STRING]], i64
4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* dereferenceable(4) getelementptr
inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*
nonnull dereferenceable(4) [[STRING]], i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -330,7 +330,7 @@ define i32
@strncmp_memcmp12([12 x i8]*</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp13([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp13(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([8 x i8], [8 x i8]* @abc, i64 0,
i64 0), i64 2)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(2)
[[STRING]], i8* dereferenceable(2) getelementptr inbounds
([8 x i8], [8 x i8]* @abc, i64 0, i64 0), i64 2)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -345,7 +345,7 @@ define i32
@strncmp_memcmp13([12 x i8]*</span><br>
</blockquote>
<blockquote type="cite"><span> define i32
@strncmp_memcmp14([12 x i8]* dereferenceable (12) %buf) {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@strncmp_memcmp14(</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT:
[[STRING:%.*]] = getelementptr inbounds [12 x i8], [12
x i8]* [[BUF:%.*]], i64 0, i64 0</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull [[STRING]], i8*
getelementptr inbounds ([8 x i8], [8 x i8]* @abc, i64 0,
i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[MEMCMP:%.*]]
= call i32 @memcmp(i8* nonnull dereferenceable(4)
[[STRING]], i8* dereferenceable(4) getelementptr inbounds
([8 x i8], [8 x i8]* @abc, i64 0, i64 0), i64 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CMP:%.*]] =
icmp eq i32 [[MEMCMP]], 0</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: [[CONV:%.*]]
= zext i1 [[CMP]] to i32</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-NEXT: ret i32
[[CONV]]</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/strcpy_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/strcpy_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/strcpy_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/strcpy_chk-1.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/strcpy_chk-1.ll Tue
Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test lib call simplification
of __strcpy_chk calls with various values</span><br>
</blockquote>
<blockquote type="cite"><span> ; for src, dst, and slen.</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -13,33 +14,36 @@ target
datalayout = "e-p:32:32:32-i1:8:8</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify1()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(12)
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0), i8* align 1 dereferenceable(12) getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8*
align 1 getelementptr inbounds ([12 x i8], [12 x i8]*
@.str, i32 0, i32 0), i32 12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strcpy_chk(i8* %dst, i8* %src, i32 60)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify2()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(12)
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0), i8* align 1 dereferenceable(12) getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8*
align 1 getelementptr inbounds ([12 x i8], [12 x i8]*
@.str, i32 0, i32 0), i32 12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strcpy_chk(i8* %dst, i8* %src, i32 12)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify3()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(12)
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0), i8* align 1 dereferenceable(12) getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8*
align 1 getelementptr inbounds ([12 x i8], [12 x i8]*
@.str, i32 0, i32 0), i32 12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strcpy_chk(i8* %dst, i8* %src, i32 -1)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -48,11 +52,12 @@ define i8*
@test_simplify3() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify4()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify4(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[STRCPY:%.*]]
= call i8* @strcpy(i8* getelementptr inbounds ([60 x i8],
[60 x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds
([60 x i8], [60 x i8]* @b, i32 0, i32 0))</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[STRCPY]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %strcpy = call
i8* @strcpy(i8* getelementptr inbounds ([60 x i8], [60 x
i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @b, i32 0, i32 0))</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %strcpy</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strcpy_chk(i8* %dst, i8* %src, i32 -1)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -61,12 +66,13 @@ define i8*
@test_simplify4() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify5()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify5(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[LEN:%.*]] =
call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1
false, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[TMP1:%.*]] =
call i8* @__memcpy_chk(i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
12, i32 [[LEN]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[TMP1]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %len = call i32
@llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60
x i8], [60 x i8]* @a, i32 0, i32 0), i1 false, i1 false,
i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %1 = call i8*
@__memcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x
i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12 x
i8], [12 x i8]* @.str, i32 0, i32 0), i32 12, i32 %len)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %1</span><br>
</blockquote>
<blockquote type="cite"><span> %len = call i32
@llvm.objectsize.i32.p0i8(i8* %dst, i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strcpy_chk(i8* %dst, i8* %src, i32 %len)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -76,11 +82,12 @@ define i8*
@test_simplify5() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify6()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify6(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[LEN:%.*]] =
call i32 @llvm.objectsize.i32.p0i8(i8* getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i1
false, i1 false, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__strcpy_chk(i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i32
[[LEN]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %len = call i32
@llvm.objectsize.i32.p0i8(i8* getelementptr inbounds ([60
x i8], [60 x i8]* @a, i32 0, i32 0), i1 false, i1 false,
i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: %ret = call i8*
@__strcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x
i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @a, i32 0, i32 0), i32 %len)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %len = call i32
@llvm.objectsize.i32.p0i8(i8* %dst, i1 false, i1 false, i1
false)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strcpy_chk(i8* %dst, i8* %dst, i32 %len)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -90,11 +97,12 @@ define i8*
@test_simplify6() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_no_simplify1() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__strcpy_chk(i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr
inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0), i32 8)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %ret = call i8*
@__strcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x
i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @b, i32 0, i32 0), i32 8)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strcpy_chk(i8* %dst, i8* %src, i32 8)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/InstCombine/strncpy_chk-1.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/strncpy_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/strncpy_chk-1.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/InstCombine/strncpy_chk-1.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/InstCombine/strncpy_chk-1.ll
Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,3 +1,4 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; Test lib call simplification
of __strncpy_chk calls with various values</span><br>
</blockquote>
<blockquote type="cite"><span> ; for len and dstlen.</span><br>
</blockquote>
<blockquote type="cite"><span> ;</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -13,33 +14,36 @@ target
datalayout = "e-p:32:32:32-i1:8:8</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify1()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(12)
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0), i8* align 1 dereferenceable(12) getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8*
align 1 getelementptr inbounds ([12 x i8], [12 x i8]*
@.str, i32 0, i32 0), i32 12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strncpy_chk(i8* %dst, i8* %src, i32 12, i32 60)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify2()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 dereferenceable(12)
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0), i8* align 1 dereferenceable(12) getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8*
align 1 getelementptr inbounds ([12 x i8], [12 x i8]*
@.str, i32 0, i32 0), i32 12, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @a, i32 0,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strncpy_chk(i8* %dst, i8* %src, i32 12, i32 12)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8* @test_simplify3()
{</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_simplify3(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[STRNCPY:%.*]] = call i8* @strncpy(i8* getelementptr
inbounds ([60 x i8], [60 x i8]* @a, i32 0, i32 0), i8*
getelementptr inbounds ([60 x i8], [60 x i8]* @b, i32 0,
i32 0), i32 12)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[STRNCPY]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %strncpy = call
i8* @strncpy(i8* getelementptr inbounds ([60 x i8], [60 x
i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @b, i32 0, i32 0), i32 12)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %strncpy</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strncpy_chk(i8* %dst, i8* %src, i32 12, i32 60)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -48,22 +52,24 @@ define i8*
@test_simplify3() {</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_no_simplify1() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify1(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__strncpy_chk(i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr
inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i32
8, i32 4)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [12 x i8], [12 x i8]* @.str, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %ret = call i8*
@__strncpy_chk(i8* getelementptr inbounds ([60 x i8], [60
x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([12
x i8], [12 x i8]* @.str, i32 0, i32 0), i32 8, i32 4)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strncpy_chk(i8* %dst, i8* %src, i32 8, i32 4)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define i8*
@test_no_simplify2() {</span><br>
</blockquote>
<blockquote type="cite"><span> ; CHECK-LABEL:
@test_no_simplify2(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[RET:%.*]] =
call i8* @__strncpy_chk(i8* getelementptr inbounds ([60 x
i8], [60 x i8]* @a, i32 0, i32 0), i8* getelementptr
inbounds ([60 x i8], [60 x i8]* @b, i32 0, i32 0), i32 8,
i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret i8*
[[RET]]</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> %dst = getelementptr
inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> %src = getelementptr
inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-NEXT: %ret = call i8*
@__strncpy_chk(i8* getelementptr inbounds ([60 x i8], [60
x i8]* @a, i32 0, i32 0), i8* getelementptr inbounds ([60
x i8], [60 x i8]* @b, i32 0, i32 0), i32 8, i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> %ret = call i8*
@__strncpy_chk(i8* %dst, i8* %src, i32 8, i32 0)</span><br>
</blockquote>
<blockquote type="cite"><span> ret i8* %ret</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>Modified:
llvm/trunk/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll</span><br>
</blockquote>
<blockquote type="cite"><span>URL: <a
href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll?rev=368657&r1=368656&r2=368657&view=diff"
moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll?rev=368657&r1=368656&r2=368657&view=diff</a></span><br>
</blockquote>
<blockquote type="cite"><span>==============================================================================</span><br>
</blockquote>
<blockquote type="cite"><span>---
llvm/trunk/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll
(original)</span><br>
</blockquote>
<blockquote type="cite"><span>+++
llvm/trunk/test/Transforms/MemCpyOpt/memcpy-to-memset-with-lifetimes.ll
Tue Aug 13 02:11:49 2019</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -1,9 +1,16 @@</span><br>
</blockquote>
<blockquote type="cite"><span>+; NOTE: Assertions have been
autogenerated by utils/update_test_checks.py</span><br>
</blockquote>
<blockquote type="cite"><span> ; RUN: opt -basicaa -memcpyopt
-instcombine -S < %s | FileCheck %s</span><br>
</blockquote>
<blockquote type="cite"><span> target datalayout =
"e-i64:64-f80:128-n8:16:32:64-S128"</span><br>
</blockquote>
<blockquote type="cite"><span> target triple =
"x86_64-unknown-linux-gnu"</span><br>
</blockquote>
<blockquote type="cite"><span> define void @foo([8 x i64]*
noalias nocapture sret dereferenceable(64) %sret) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @foo(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry-block:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[SRET1:%.*]]
= bitcast [8 x i64]* [[SRET:%.*]] to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* nonnull align 8
dereferenceable(64) [[SRET1]], i8 0, i64 64, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry-block:</span><br>
</blockquote>
<blockquote type="cite"><span> %a = alloca [8 x i64], align
8</span><br>
</blockquote>
<blockquote type="cite"><span> %a.cast = bitcast [8 x i64]*
%a to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -14,14 +21,23 @@ entry-block:</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.lifetime.end.p0i8(i64 64, i8* %a.cast)</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @foo(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK:
%[[sret_cast:[^=]+]] = bitcast [8 x i64]* %sret to
i8*</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* nonnull align 8 %[[sret_cast]],
i8 0, i64 64</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NOT: call void
@llvm.memcpy</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> define void @bar([8 x i64]*
noalias nocapture sret dereferenceable(64) %sret, [8 x
i64]* noalias nocapture dereferenceable(64) %out) {</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-LABEL: @bar(</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: entry-block:</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[A:%.*]] =
alloca [8 x i64], align 8</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: [[A_CAST:%.*]]
= bitcast [8 x i64]* [[A]] to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.lifetime.start.p0i8(i64 64, i8* nonnull [[A_CAST]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* nonnull align 8
dereferenceable(64) [[A_CAST]], i8 0, i64 64, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[SRET_CAST:%.*]] = bitcast [8 x i64]* [[SRET:%.*]] to
i8*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* nonnull align 8
dereferenceable(64) [[SRET_CAST]], i8 0, i64 64, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memset.p0i8.i64(i8* nonnull align 8
dereferenceable(32) [[A_CAST]], i8 42, i64 32, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT:
[[OUT_CAST:%.*]] = bitcast [8 x i64]* [[OUT:%.*]] to
i8*</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8
dereferenceable(64) [[OUT_CAST]], i8* nonnull align 8
dereferenceable(64) [[A_CAST]], i64 64, i1 false)</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: call void
@llvm.lifetime.end.p0i8(i64 64, i8* nonnull [[A_CAST]])</span><br>
</blockquote>
<blockquote type="cite"><span>+; CHECK-NEXT: ret void</span><br>
</blockquote>
<blockquote type="cite"><span>+;</span><br>
</blockquote>
<blockquote type="cite"><span> entry-block:</span><br>
</blockquote>
<blockquote type="cite"><span> %a = alloca [8 x i64], align
8</span><br>
</blockquote>
<blockquote type="cite"><span> %a.cast = bitcast [8 x i64]*
%a to i8*</span><br>
</blockquote>
<blockquote type="cite"><span>@@ -35,17 +51,6 @@ entry-block:</span><br>
</blockquote>
<blockquote type="cite"><span> call void
@llvm.lifetime.end.p0i8(i64 64, i8* %a.cast)</span><br>
</blockquote>
<blockquote type="cite"><span> ret void</span><br>
</blockquote>
<blockquote type="cite"><span> -; CHECK-LABEL: @bar(</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: %[[a:[^=]+]] =
alloca [8 x i64]</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK:
%[[a_cast:[^=]+]] = bitcast [8 x i64]* %[[a]] to
i8*</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: call void
@llvm.memset.p0i8.i64(i8* nonnull align 8 %[[a_cast]], i8
0, i64 64</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK:
%[[sret_cast:[^=]+]] = bitcast [8 x i64]* %sret to
i8*</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: call void
@llvm.memset.p0i8.i64(i8* nonnull align 8 %[[sret_cast]],
i8 0, i64 64</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: call void
@llvm.memset.p0i8.i64(i8* nonnull align 8 %[[a_cast]], i8
42, i64 32</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK:
%[[out_cast:[^=]+]] = bitcast [8 x i64]* %out to
i8*</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: call void
@llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8
%[[out_cast]], i8* nonnull align 8 %[[a_cast]], i64 64</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK-NOT: call void
@llvm.memcpy</span><br>
</blockquote>
<blockquote type="cite"><span>-; CHECK: ret void</span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span> declare void
@llvm.lifetime.start.p0i8(i64, i8* nocapture) nounwind</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>_______________________________________________</span><br>
</blockquote>
<blockquote type="cite"><span>llvm-commits mailing list</span><br>
</blockquote>
<blockquote type="cite"><span><a
href="mailto:llvm-commits@lists.llvm.org"
moz-do-not-send="true">llvm-commits@lists.llvm.org</a></span><br>
</blockquote>
<blockquote type="cite"><span><a
href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits"
moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a></span><br>
</blockquote>
<span></span><br>
</div>
</blockquote>
</blockquote>
</body>
</html>