https://llvm.org/bugs/show_bug.cgi?id=31368
Bug ID: 31368 Summary: [Scalar] alignTo is not optimized if alignment is a power of 2 Product: libraries Version: trunk Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: Scalar Optimizations Assignee: unassignedb...@nondot.org Reporter: dav...@freebsd.org CC: llvm-bugs@lists.llvm.org Classification: Unclassified This came up as part of https://reviews.llvm.org/D27082 Testcase by Rafael. uint64_t foo(uint64_t Value, uint64_t Align) { return alignToNonP2(Value, 1 << Align); } but it still produces define i64 @_Z3foomm(i64 %Value, i64 %Align) local_unnamed_addr #0 { entry: %sh_prom = trunc i64 %Align to i32 %shl = shl i32 1, %sh_prom %conv = sext i32 %shl to i64 %add.i = add i64 %Value, -1 %sub.i = add i64 %add.i, %conv %div.i = urem i64 %sub.i, %conv %add2.i = sub i64 %sub.i, %div.i ret i64 %add2.i } Changing 1 to 1ULL does cause us to optimize it define i64 @_Z3foomm(i64 %Value, i64 %Align) local_unnamed_addr #0 { entry: %shl = shl i64 1, %Align %add.i = add i64 %Value, -1 %sub.i = add i64 %add.i, %shl %.not = sub i64 0, %shl %add2.i = and i64 %sub.i, %.not ret i64 %add2.i } -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs