[PATCH] D83101: [Scalarizer] ExtractElement handling w/ constant extract index
mattias.v.eriksson@ericsson.com via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 00:51:26 PDT 2020
materi added a comment.
In D83101#2223698 <https://reviews.llvm.org/D83101#2223698>, @lebedev.ri wrote:
> In D83101#2223689 <https://reviews.llvm.org/D83101#2223689>, @materi wrote:
>
>> We have seen some issues with missing symbols during linking that I think are caused by this patch. The origin of this is downstream fuzz testing.
>>
>> The global variable `aglobal` is renamed:
>>
>> $ cat global.ll
>> @aglobal = dso_local global i16 0, align 1
>> @b = dso_local local_unnamed_addr global i16 0, align 1
>>
>> define dso_local void @c() local_unnamed_addr {
>> entry:
>> %d.sroa.0.1.vec.extract = extractelement <4 x i16*> <i16* @aglobal, i16* @aglobal, i16* @aglobal, i16* @aglobal>, i32 1
>> %0 = ptrtoint i16* %d.sroa.0.1.vec.extract to i16
>> store i16 %0, i16* @b, align 1
>> ret void
>> }
>>
>> $ opt -scalarizer global.ll -S
>> ; ModuleID = 'global.ll'
>> source_filename = "global.ll"
>>
>> @d.sroa.0.1.vec.extract = dso_local global i16 0, align 1
>> @b = dso_local local_unnamed_addr global i16 0, align 1
>>
>> define dso_local void @c() local_unnamed_addr {
>> entry:
>> %0 = ptrtoint i16* @d.sroa.0.1.vec.extract to i16
>> store i16 %0, i16* @b, align 1
>> ret void
>> }
>
> I see that the global is renamed, https://godbolt.org/z/PM95se, it's not really intentional.
> But i think something else is missing in this test - what's the failure? `-verify` passes
I don't think there is a verifier that points out this issue. But consider if there is another .ll file which has an external reference to the global:
@aglobal = external dso_local local_unnamed_addr global i16, align 1
define dso_local i16 @main() local_unnamed_addr #0 {
entry:
%0 = load i16, i16* @aglobal, align 1
ret i16 %0
}
In this case you get link error when `@aglobal` has been renamed in global.ll.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83101/new/
https://reviews.llvm.org/D83101
More information about the llvm-commits
mailing list