<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Many thanks for pointing out this. We will see whether the problem will go away once the pull down from the community version is completed.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> David Majnemer [mailto:david.majnemer@gmail.com]
<br>
<b>Sent:</b> Friday, December 2, 2016 2:04 PM<br>
<b>To:</b> Lin, Jin <jin.lin@intel.com><br>
<b>Cc:</b> Caldarale, Charles R <Chuck.Caldarale@unisys.com>; llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] Is the instruction %4 = select i1 %tobool.i, metadata !12, metadata !10 legal?<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">I cannot reproduce this in LLVM r288194. Your IR seems to be quite non-typical with intrinsics like "@llvm..fakeload.p0p0i32"...<o:p></o:p></p>
<div>
<p class="MsoNormal">I'm not sure what you have here but it can be explained if you have branched off of some older LLVM. Hal fixed a bug that looked just like this one in r280866:
<a href="https://github.com/llvm-mirror/llvm/commit/9e7800b23b43fa5f2ada1be28e71fb81f3f38437">
https://github.com/llvm-mirror/llvm/commit/9e7800b23b43fa5f2ada1be28e71fb81f3f38437</a><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Fri, Dec 2, 2016 at 11:08 AM, Lin, Jin via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">To reproduce the issue, please use the command line "opt -simplifycfg filename".<br>
<br>
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
target triple = "x86_64-unknown-linux-gnu"<br>
<br>
%struct.G = type { %struct.ordered_index_node*, i32 }<br>
%struct.ordered_index_node = type { %struct.B, %struct.F }<br>
%struct.B = type { i32 }<br>
%struct.F = type { i32*, i32* }<br>
<br>
$_ZN1G13final_insert_Ev = comdat any<br>
<br>
$_ZN1G7insert_Ev = comdat any<br>
<br>
$_ZN1F4leftEv = comdat any<br>
<br>
$_ZN1F5rightEv = comdat any<br>
<br>
; Function Attrs: uwtable<br>
define void @_Z3fn1v() local_unnamed_addr #0 {<br>
entry:<br>
%t = alloca %struct.G, align 8<br>
%0 = bitcast %struct.G* %t to i8*<br>
call void @llvm.lifetime.start(i64 16, i8* %0) #5<br>
call void @_ZN1G13final_insert_Ev(%struct.G* nonnull %t)<br>
call void @llvm.lifetime.end(i64 16, i8* %0) #5<br>
ret void<br>
}<br>
<br>
; Function Attrs: argmemonly nounwind<br>
declare void @llvm.lifetime.start(i64, i8* nocapture) #1<br>
<br>
; Function Attrs: uwtable<br>
define linkonce_odr void @_ZN1G13final_insert_Ev(%struct.G* %this) local_unnamed_addr #0 comdat align 2 {<br>
entry:<br>
%call = call dereferenceable(16) %struct.G* @_ZN1G5finalEv(%struct.G* %this)<br>
%link_point_c.i = getelementptr inbounds %struct.G, %struct.G* %call, i64 0, i32 1<br>
%0 = load i32, i32* %link_point_c.i, align 8, !tbaa !1<br>
%tobool.i = icmp eq i32 %0, 0<br>
%1 = bitcast %struct.G* %call to i8**<br>
%2 = load i8*, i8** %1, align 8, !tbaa !7<br>
br i1 %tobool.i, label %cond.false.i, label %cond.true.i<br>
<br>
cond.true.i: ; preds = %entry<br>
%add.ptr.i = getelementptr inbounds i8, i8* %2, i64 8<br>
%left_.i.i = bitcast i8* %add.ptr.i to i32**<br>
%3 = call i32** @llvm..fakeload.p0p0i32(i32** %left_.i.i, metadata !8) #5<br>
br label %_ZN1G7insert_Ev.exit<br>
<br>
cond.false.i: ; preds = %entry<br>
%right_.i.i = getelementptr inbounds i8, i8* %2, i64 16<br>
%4 = bitcast i8* %right_.i.i to i32**<br>
%5 = call i32** @llvm..fakeload.p0p0i32(i32** %4, metadata !11) #5<br>
br label %_ZN1G7insert_Ev.exit<br>
<br>
_ZN1G7insert_Ev.exit: ; preds = %cond.true.i, %cond.false.i<br>
%call4.sink.i = phi i32** [ %5, %cond.false.i ], [ %3, %cond.true.i ]<br>
%6 = load i32*, i32** %call4.sink.i, align 8, !tbaa !12<br>
call void @_ZN18ordered_index_node9from_implEPi(i32* %6)<br>
ret void<br>
}<br>
<br>
; Function Attrs: argmemonly nounwind<br>
declare void @llvm.lifetime.end(i64, i8* nocapture) #1<br>
<br>
declare dereferenceable(16) %struct.G* @_ZN1G5finalEv(%struct.G*) local_unnamed_addr #2<br>
<br>
; Function Attrs: uwtable<br>
define linkonce_odr void @_ZN1G7insert_Ev(%struct.G* %this) local_unnamed_addr #0 comdat align 2 {<br>
entry:<br>
%link_point_c = getelementptr inbounds %struct.G, %struct.G* %this, i64 0, i32 1<br>
%0 = load i32, i32* %link_point_c, align 8, !tbaa !1<br>
%tobool = icmp eq i32 %0, 0<br>
%1 = bitcast %struct.G* %this to i8**<br>
%2 = load i8*, i8** %1, align 8, !tbaa !7<br>
br i1 %tobool, label %cond.false, label %cond.true<br>
<br>
cond.true: ; preds = %entry<br>
%add.ptr = getelementptr inbounds i8, i8* %2, i64 8<br>
%left_.i = bitcast i8* %add.ptr to i32**<br>
%3 = call i32** @llvm..fakeload.p0p0i32(i32** %left_.i, metadata !8) #5<br>
br label %cond.end<br>
<br>
cond.false: ; preds = %entry<br>
%right_.i = getelementptr inbounds i8, i8* %2, i64 16<br>
%4 = bitcast i8* %right_.i to i32**<br>
%5 = call i32** @llvm..fakeload.p0p0i32(i32** %4, metadata !11) #5<br>
br label %cond.end<br>
<br>
cond.end: ; preds = %cond.false, %cond.true<br>
%call4.sink = phi i32** [ %5, %cond.false ], [ %3, %cond.true ]<br>
%6 = load i32*, i32** %call4.sink, align 8, !tbaa !12<br>
call void @_ZN18ordered_index_node9from_implEPi(i32* %6)<br>
ret void<br>
}<br>
<br>
declare void @_ZN18ordered_index_node9from_implEPi(i32*) local_unnamed_addr #2<br>
<br>
; Function Attrs: nounwind uwtable<br>
define linkonce_odr dereferenceable(8) i32** @_ZN1F4leftEv(%struct.F* %this) local_unnamed_addr #3 comdat align 2 {<br>
entry:<br>
%left_ = getelementptr inbounds %struct.F, %struct.F* %this, i64 0, i32 0<br>
%0 = call i32** @llvm..fakeload.p0p0i32(i32** %left_, metadata !8) #5<br>
ret i32** %0<br>
}<br>
<br>
; Function Attrs: nounwind uwtable<br>
define linkonce_odr dereferenceable(8) i32** @_ZN1F5rightEv(%struct.F* %this) local_unnamed_addr #3 comdat align 2 {<br>
entry:<br>
%right_ = getelementptr inbounds %struct.F, %struct.F* %this, i64 0, i32 1<br>
%0 = call i32** @llvm..fakeload.p0p0i32(i32** %right_, metadata !11) #5<br>
ret i32** %0<br>
}<br>
<br>
; Function Attrs: nounwind readnone<br>
declare i32** @llvm..fakeload.p0p0i32(i32**, metadata) #4<br>
<br>
attributes #0 = { uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }<br>
attributes #1 = { argmemonly nounwind }<br>
attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "stack-protector-buffer-size"="8"
"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }<br>
attributes #3 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }<br>
attributes #4 = { nounwind readnone }<br>
attributes #5 = { nounwind }<br>
<br>
!llvm.ident = !{!0}<br>
<br>
!0 = !{!"clang version 4.0.0 (branches/20501)"}<br>
!1 = !{!2, !6, i64 8}<br>
!2 = !{!"struct@_ZTS1G", !3, i64 0, !6, i64 8}<br>
!3 = !{!"pointer@_ZTSP18ordered_index_node", !4, i64 0}<br>
!4 = !{!"omnipotent char", !5, i64 0}<br>
!5 = !{!"Simple C++ TBAA"}<br>
!6 = !{!"int", !4, i64 0}<br>
!7 = !{!2, !3, i64 0}<br>
!8 = !{!9, !10, i64 0}<br>
!9 = !{!"struct@_ZTS1F", !10, i64 0, !10, i64 8}<br>
!10 = !{!"pointer@_ZTSPi", !4, i64 0}<br>
!11 = !{!9, !10, i64 8}<br>
!12 = !{!10, !10, i64 0}<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">-----Original Message-----<br>
From: Caldarale, Charles R [mailto:<a href="mailto:Chuck.Caldarale@unisys.com">Chuck.Caldarale@unisys.com</a>]<br>
Sent: Friday, December 2, 2016 10:51 AM<br>
To: Lin, Jin <<a href="mailto:jin.lin@intel.com">jin.lin@intel.com</a>>; <a href="mailto:llvm-dev@lists.llvm.org">
llvm-dev@lists.llvm.org</a><br>
Subject: RE: Is the instruction %4 = select i1 %tobool.i, metadata !12, metadata !10 legal?<br>
<br>
> From: llvm-dev [mailto:<a href="mailto:llvm-dev-bounces@lists.llvm.org">llvm-dev-bounces@lists.llvm.org</a>]<br>
> On Behalf Of Lin, Jin via llvm-dev<br>
> Subject: [llvm-dev] Is the instruction %4 = select i1 %tobool.i, metadata !12, metadata !10 legal?<br>
<br>
> I wonder whether this is valid LLVM IR:<br>
> %4 = select i1 %tobool.i, metadata !12, metadata !10<br>
<br>
> Before CFGSimplify<br>
> cond.true.i: ; preds = %entry<br>
> %add.ptr.i = getelementptr inbounds i8, i8* %2, i64 8<br>
> %left_.i.i = bitcast i8* %add.ptr.i to i32**<br>
> %3 = call i32** @llvm.fakeload.p0p0i32(i32** %left_.i.i, metadata !8) #6 br label %_ZN1G7insert_Ev.exit<br>
> cond.false.i: ; preds = %entry<br>
> %right_.i.i = getelementptr inbounds i8, i8* %2, i64 16<br>
> %4 = bitcast i8* %right_.i.i to i32**<br>
> %5 = call i32** @llvm.fakeload.p0p0i32(i32** %4, metadata !11) #6<br>
> br label %_ZN1G7insert_Ev.exit<br>
<br>
> After CFGSimplify<br>
> %4 = select i1 %tobool.i, metadata !12, metadata !10<br>
> %add.ptr.i = getelementptr inbounds i8, i8* %2, i64 %3<br>
> %left_.i.i = bitcast i8* %add.ptr.i to i32**<br>
> %5 = call i32** @llvm.fakeload.p0p0i32(i32** %left_.i.i, metadata %4) #6<br>
> %6 = load i32*, i32** %5, align 8, !tbaa !8<br>
<br>
Is there any more to the original IR? I don't think CFGSimplify would have magically created %tobool.i, yet it doesn't appear in the provided before snippet.<br>
<br>
- Chuck<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>