[PATCH] D106667: SROA: Enhance speculateSelectInstLoads
Christudasan Devadasan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 9 01:24:03 PDT 2021
cdevadas added a comment.
I reverted the patch for now.
Missed the case when both bitcasted and non-bitcasted loads can exist at the same time.
In my patch, I should have retained the original TV and FV values rather than overwriting them with the new bitcast instructions. They are required for the non-bitcasted loads.
The loop for select users makes sense. I will upload a new patch.
; opt -S -sroa bug.ll -o out.ll
%struct.lookup_args = type { i32, i32* }
define void @arg_lookup(i1 %cmp){
entry:
%args = alloca [2 x %struct.lookup_args], align 16
%ptr = bitcast [2 x %struct.lookup_args]* %args to i8*
%arraydecay = getelementptr inbounds [2 x %struct.lookup_args], [2 x %struct.lookup_args]* %args, i64 0, i64 0
%add.ptr = getelementptr inbounds [2 x %struct.lookup_args], [2 x %struct.lookup_args]* %args, i64 0, i64 1
%cond = select i1 %cmp, %struct.lookup_args* %add.ptr, %struct.lookup_args* %arraydecay
%addr.i = getelementptr inbounds %struct.lookup_args, %struct.lookup_args* %cond, i64 0, i32 1
%bcast.i8 = bitcast i32** %addr.i to i8**
%addr.i8 = load i8*, i8** %bcast.i8, align 8
call void @foo_i8(i8* %addr.i8)
%addr.i32 = load i32*, i32** %addr.i, align 8
call void @foo_i32 (i32* %addr.i32)
ret void
}
declare void @foo_i8(i8*)
declare void @foo_i32(i32*)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106667/new/
https://reviews.llvm.org/D106667
More information about the llvm-commits
mailing list