[PATCH] D65402: [Attributor][MustExec] Deduce dereferenceable and nonnull attribute using MustBeExecutedContextExplorer
Hideto Ueno via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 13:41:09 PDT 2019
uenoku added a comment.
In D65402#1638243 <https://reviews.llvm.org/D65402#1638243>, @xbolva00 wrote:
> Hi,
> my another question :)
> clang -std=c99 -Ofast -DNDEBUG -S -emit-llvm -mllvm -enable-nonnull-arg-prop -mllvm -attributor-disable=false code.c
>
> define dso_local noalias %struct.tHashTableItem* @symbolNewCopy(%struct.tHashTableItem* nocapture readonly %symbol) local_unnamed_addr #2 {
> entry:
>
> %call = tail call noalias i8* @malloc(i64 64) #8
> %0 = bitcast i8* %call to %struct.tHashTableItem*
> %1 = bitcast %struct.tHashTableItem* %symbol to i8*
> tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 dereferenceable(64) %call, i8* nonnull align 8 dereferenceable(64) %1, i64 64, i1 false)
> %cmp = icmp eq i8* %call, null
>
>
> Curently LLVM fails to propagate attributes to arguments thru bitcasts, it seems. With this patch help with this case?
In D65402#1638312 <https://reviews.llvm.org/D65402#1638312>, @xbolva00 wrote:
> Uhm.
>
> Even simple case with "-mllvm -enable-nonnull-arg-prop" does not work.. strange. Hopefully with Attributor it would work.
>
> define dso_local noalias %struct.tHashTableItem* @symbolNewCopy(i8* nocapture readonly %s) local_unnamed_addr #0 {
> entry:
>
> %call = tail call noalias i8* @calloc(i64 1, i64 64) #8
> %call.i = tail call noalias i8* @calloc(i64 1, i64 64) #8
> %Index.i = getelementptr inbounds i8, i8* %call.i, i64 24
> %0 = bitcast i8* %Index.i to i32*
> store i32 -1, i32* %0, align 8, !tbaa !14
> %bcmp = tail call i32 @bcmp(i8* nonnull dereferenceable(7) %call.i, i8* nonnull dereferenceable(7) %s, i64 7)
These cases are not so complex that I think this patch can handle.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65402/new/
https://reviews.llvm.org/D65402
More information about the llvm-commits
mailing list