[llvm-bugs] [Bug 39780] New: Missing constant fold optimization with partial store/load
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Nov 25 13:54:40 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=39780
Bug ID: 39780
Summary: Missing constant fold optimization with partial
store/load
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: joker.eph at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181125/eb98e11e/attachment.html>
More information about the llvm-bugs
mailing list