[LoongArch] Support load/store of dso_local PIC global values
authorFangrui Song <i@maskray.me>
Fri, 22 Jul 2022 02:37:56 +0000 (19:37 -0700)
committerFangrui Song <i@maskray.me>
Fri, 22 Jul 2022 02:37:56 +0000 (19:37 -0700)
commit9742166935f48d0e84f5b721819208fbc0afae3a
tree51abb65705059a755fdc90d8c8ea30f07815c72b
parentd805aabe8ff79c71f29c6cc957514cd9f71fc252
[LoongArch] Support load/store of dso_local PIC global values

lowerGlobalAddress added by D128427 can be used for PIC. The actual condition is
that the global value needs to be dso_local (a dso_preemptable one needs GOT
indirection).

load-store.ll has UB due to out-of-bounds load/store. Fix the UB in the variable
test and add an array test. Note: NOPIC array index is currently wrong.

Reviewed By: wangleiat

Differential Revision: https://reviews.llvm.org/D129977
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
llvm/test/CodeGen/LoongArch/ir-instruction/load-store.ll