[Attributor] Remove function pointer restriction for AAAlign
authorNikita Popov <npopov@redhat.com>
Thu, 3 Mar 2022 14:41:06 +0000 (15:41 +0100)
committerNikita Popov <npopov@redhat.com>
Mon, 7 Mar 2022 09:02:45 +0000 (10:02 +0100)
commita9b03d9e2e3888ad08f9f0294c6e6bec43d7c884
tree62ab45b48fbae3f97a70e2b9dc3970545b4ef5c6
parent43b638241aa8c114e5a5b44b38630af43ca9f84f
[Attributor] Remove function pointer restriction for AAAlign

This check is not compatible with opaque pointers. We can avoid
it by adjusting the getPointerAlignment() implementation to avoid
creating unnecessary ptrtoint expressions for bitcasted pointers.
The code already uses OnlyIfReduced to not create an expression
if it does not simplify, and this makes sure that folding a
bitcast and ptrtoint into a ptrtoint doesn't count as a
simplification.

Differential Revision: https://reviews.llvm.org/D120904
llvm/lib/IR/Value.cpp
llvm/lib/Transforms/IPO/AttributorAttributes.cpp