If we use a pointer generated by inttoptr(load(%object)), use object as
underlying object. I am not entirely sure if this is valid given the
GetUnderlyingObject semantics and would appreciate your feedback!
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 28825 Build 28824: arc lint + arc unit
Event Timeline
Comment Actions
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.
Comment Actions
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 }
Comment Actions
Just realized this went one step too far up the chain. The underlying object is the loaded value from the stack, but we cannot return that from GetUnderlyingObject, because it does not have a pointer type. I'll try to think of something else.