[AArch64][GlobalISel] Don't match thread-local globals in matchFoldGlobalOffset
authorJessica Paquette <jpaquette@apple.com>
Wed, 28 Apr 2021 18:13:19 +0000 (11:13 -0700)
committerJessica Paquette <jpaquette@apple.com>
Wed, 28 Apr 2021 20:48:18 +0000 (13:48 -0700)
commit4d41810cf6798da7541a512e291b7c568db9ed8b
tree74aab6aa8b19784cff65fb976ae7e5ac055ac83a
parent4623d4ff85b0f214a4ce2b50649e6f1e8cff8d01
[AArch64][GlobalISel] Don't match thread-local globals in matchFoldGlobalOffset

SelectionDAG has separate ISD opcodes for regular global values and thread-local
global values, while GlobalISel does not.

This combine was ported from SDAG directly without knowing that. As a result,
it was running on TLS globals.

This makes it so that `matchFoldGlobalOffset` doesn't match on TLS globals, and
adds an assert to `selectTLSGlobalValue` to make sure that TLS globals never
have offsets.

Differential Revision: https://reviews.llvm.org/D101478
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/lib/Target/AArch64/GISel/AArch64PreLegalizerCombiner.cpp
llvm/test/CodeGen/AArch64/GlobalISel/fold-global-offsets.mir