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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 15:59:26 PDT 2020


craig.topper marked an inline comment as done.
craig.topper added inline comments.


================
Comment at: llvm/lib/Target/X86/X86Subtarget.cpp:91
       case CodeModel::Medium:
-        if (isa<Function>(GV))
+        if (isa_and_nonnull<Function>(GV))
           return X86II::MO_NO_FLAG; // All code is RIP-relative
----------------
echristo wrote:
> Seems reasonable to either comment your commit message here or try to fix the nullptr into classifyLocalReference and assert nonnull?
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.


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

https://reviews.llvm.org/D80763





More information about the llvm-commits mailing list