[PATCH] D59009: [BasicAA] Peak through IntToPtr(Load(%object))

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 18:51:46 PST 2019


fhahn added a comment.

In D59009#1419379 <https://reviews.llvm.org/D59009#1419379>, @efriedma wrote:

> Could you describe why you think this is correct?  As far as I can tell, the "underlying object" you're returning isn't even related to the input pointer.


Hm,   `%addr = load i64, i64* %base, align 8` loads from the alloca'd location, but I am not entirely sure. The cast to i64* and inttoptr should do the same thing as the snippet below, unless I am missing something? (which is quite likely, as I am not very familiar with inttoptr)

  define void @test1(i64 %arg) {
    %loc = alloca %struct.data*, align 8
    call void @init(%struct.data** %loc )
  
    %addr = load %struct.data*, %struct.data** %loc, align 8
    %offset.ptr = getelementptr inbounds %struct.data, %struct.data* %addr, i64 0, i32 1
    %offset = load i64, i64* %offset.ptr, align 8, !range !13
    %gep.1 = getelementptr inbounds %struct.data, %struct.data* %addr, i64 0, i32 2
    %gep.2 = getelementptr inbounds [20 x i64], [20 x i64]* %gep.1, i64 0, i64 %offset
    store i64 1, i64* %gep.2, align 8
    ret void
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59009





More information about the llvm-commits mailing list