[llvm-bugs] [Bug 48224] New: [AssumeBundles] ValueTracking cannot use alignment assumptions
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 18 18:32:23 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48224
Bug ID: 48224
Summary: [AssumeBundles] ValueTracking cannot use alignment
assumptions
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Global Analyses
Assignee: unassignedbugs at nondot.org
Reporter: nikolai.bozhenov at intel.com
CC: llvm-bugs at lists.llvm.org
This is a regression caused by switch to using operand bundles to encode
alignment assumptions
(https://reviews.llvm.org/rG78de7297abe2e8fa782682168989c70e3cb34a5c).
It looks like the ValueTracking (computeKnownBits) cannot understand the new
format of alignment assumptions. As an example, consider compilation of the
following reproducer with clang-11 (old @llvm.assume format) and clang-trunk
(@llvm.assume with bundles):
#include <stdint.h>
int foo(int *p) {
__builtin_assume_aligned(p, 32);
return ((intptr_t) p) & 4;
}
clang-11 (https://godbolt.org/z/xGh1e4) computes the returned value statically:
ret i32 0
clang-trunk (https://godbolt.org/z/1jWe5j) fails to optimize the code:
%3 = ptrtoint i32* %0 to i64
%4 = trunc i64 %3 to i32
%5 = and i32 %4, 4
ret i32 %5
As one can see, after switching to operand bundles, clang-trunk lost its
ability to reason about low bits in aligned pointers.
--
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/20201119/600ead70/attachment.html>
More information about the llvm-bugs
mailing list