This is an archive of the discontinued LLVM Phabricator instance.

[X86] Fix a nullptr defrence in X86Subtarget::classifyLocalReference when compiling with -mcmodel=medium -fpic and using a constant pool
ClosedPublic

Authored by craig.topper on May 28 2020, 2:48 PM.

Details

Summary

LowerConstantPool passes a nullptr into classifyLocalReference. The medium code model handling for PIC will try to deference it using isa. This patch switches to isa_and_nonnull.

Diff Detail

Event Timeline

craig.topper created this revision.May 28 2020, 2:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 28 2020, 2:48 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
echristo accepted this revision.May 28 2020, 3:01 PM

Accepting, couple of options as to some other directions as well if you want to go there.

llvm/lib/Target/X86/X86Subtarget.cpp
91–93

Seems reasonable to either comment your commit message here or try to fix the nullptr into classifyLocalReference and assert nonnull?

This revision is now accepted and ready to land.May 28 2020, 3:01 PM
craig.topper marked an inline comment as done.May 28 2020, 3:58 PM
craig.topper added inline comments.
llvm/lib/Target/X86/X86Subtarget.cpp
91–93

Looks like there are several places that handle constants to that pass null, fastisel, globalisel and regular isel. Also jump tables.

This function takes a GlobalValue and constants and jump table don't exist as GlobalValues do they? So I'm not sure how to fix the nullptr input.

This revision was automatically updated to reflect the committed changes.