[PATCH] D71499: Add builtins for aligning and checking alignment of pointers and integers

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 14 03:39:39 PST 2019


lebedev.ri marked an inline comment as done.
lebedev.ri added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:14323
+    Result = Builder.CreateIntrinsic(
+        Intrinsic::ptrmask, {Args.SrcType, SrcForMask->getType(), Args.IntType},
+        {SrcForMask, NegatedMask}, nullptr, "aligned_result");
----------------
arichardson wrote:
> lebedev.ri wrote:
> > Is sufficient amount of passes, analyses know about this intrinsic?
> Good question. In the simple test cases that I looked at the code generation was equivalent. 
> 
> In our fork we still use ptrtoint+inttoptr since I implemented them before the new intrinsic existed. But since the ptrmask instrinsic exists now I thought I'd use it for upstreaming.
> I'll investigate if this results in worse codegen for more complex uses.
> 
(TLDR: before producing it in more cases in clang, i think it should be first ensured
that everything in middle-end is fully aware of said intrinsic. (i.e. using it vs it's
exploded form results in no differences in final assembly on a sufficient test coverage))


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71499/new/

https://reviews.llvm.org/D71499





More information about the cfe-commits mailing list