<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Missing constant fold optimization with partial store/load"
href="https://bugs.llvm.org/show_bug.cgi?id=39780">39780</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missing constant fold optimization with partial store/load
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>joker.eph@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>See attached file, IR looks like:
%struct.s1 = type { [3 x i8] }
@__const.test_1.g1 = private unnamed_addr constant { i8, i8, i8 } { i8 -17, i8
-66, i8 11 }, align 1
; Function Attrs: nounwind readnone
define i64 @test_1() local_unnamed_addr #3 {
entry:
%g1.sroa.0 = alloca [3 x i8], align 2
%g1.sroa.0.0..sroa_idx56 = getelementptr inbounds [3 x i8], [3 x i8]*
%g1.sroa.0, i64 0, i64 0
call void @llvm.lifetime.start.p0i8(i64 3, i8* nonnull
%g1.sroa.0.0..sroa_idx56)
call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 2
%g1.sroa.0.0..sroa_idx56, i8* align 1 getelementptr inbounds ({ i8, i8, i8 }, {
i8, i8, i8 }* @__const.test_1.g1, i64 0, i32 0), i64 3, i1 false)
%g1.sroa.0.0..sroa_cast54 = bitcast [3 x i8]* %g1.sroa.0 to i16*
%g1.sroa.0.1..sroa_idx57 = getelementptr inbounds [3 x i8], [3 x i8]*
%g1.sroa.0, i64 0, i64 1
%g1.sroa.0.1..sroa_cast58 = bitcast i8* %g1.sroa.0.1..sroa_idx57 to i16*
store i16 1682, i16* %g1.sroa.0.1..sroa_cast58, align 1
%g1.sroa.0.0.g1.sroa.0.0.bf.load12 = load i16, i16*
%g1.sroa.0.0..sroa_cast54, align 2
%bf.shl13 = shl i16 %g1.sroa.0.0.g1.sroa.0.0.bf.load12, 6
%bf.ashr1431 = ashr exact i16 %bf.shl13, 6
%xor2372 = xor i16 %bf.ashr1431, -451
%xor23 = sext i16 %xor2372 to i64
call void @llvm.lifetime.end.p0i8(i64 3, i8* nonnull
%g1.sroa.0.0..sroa_idx56)
ret i64 %xor23
}
This whole function could fold away to return only a constant</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>