[PATCH] D50116: [X86] FastISel fall back on !absolute_symbol GVs

Vlad Tsyrklevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 16:36:35 PDT 2018


vlad.tsyrklevich created this revision.
vlad.tsyrklevich added reviewers: pcc, craig.topper.
Herald added subscribers: llvm-commits, hiraditya.

https://reviews.llvm.org/D25878, which added support for !absolute_symbol for normal X86 ISel,
did not add support for materializing references to absolute symbols for
X86 FastISel. This causes build failures because FastISel generates
PC-relative relocations for absolute symbols. Fall back to normal ISel
for references to !absolute_symbol GVs. Fix for PR38200.


Repository:
  rL LLVM

https://reviews.llvm.org/D50116

Files:
  llvm/lib/Target/X86/X86FastISel.cpp
  llvm/test/CodeGen/X86/absolute-bit-mask-fastisel.ll


Index: llvm/test/CodeGen/X86/absolute-bit-mask-fastisel.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/absolute-bit-mask-fastisel.ll
@@ -0,0 +1,28 @@
+; RUN: llc < %s | FileCheck %s
+; RUN: llc -relocation-model=pic < %s | FileCheck %s
+
+; Regression test for PR38200
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+ at bit_mask8 = external hidden global i8, !absolute_symbol !0
+
+declare void @f()
+
+define void @foo8(i8* %ptr) noinline optnone {
+  %load = load i8, i8* %ptr
+  ; CHECK: movl $bit_mask8, %ecx
+  %and = and i8 %load, ptrtoint (i8* @bit_mask8 to i8)
+  %icmp = icmp eq i8 %and, 0
+  br i1 %icmp, label %t, label %f
+
+t:
+  call void @f()
+  ret void
+
+f:
+  ret void
+}
+
+!0 = !{i64 0, i64 256}
Index: llvm/lib/Target/X86/X86FastISel.cpp
===================================================================
--- llvm/lib/Target/X86/X86FastISel.cpp
+++ llvm/lib/Target/X86/X86FastISel.cpp
@@ -738,6 +738,10 @@
     if (GV->isThreadLocal())
       return false;
 
+    // Can't handle !absolute_symbol references yet.
+    if (GV->isAbsoluteSymbolRef())
+      return false;
+
     // RIP-relative addresses can't have additional register operands, so if
     // we've already folded stuff into the addressing mode, just force the
     // global value into its own register, which we can use as the basereg.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50116.158417.patch
Type: text/x-patch
Size: 1450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180731/b4121f72/attachment.bin>


More information about the llvm-commits mailing list