Skip to content

Commit 6979410

Browse files
committed
Merging r338599:
------------------------------------------------------------------------ r338599 | vlad.tsyrklevich | 2018-08-01 19:44:37 +0200 (Wed, 01 Aug 2018) | 16 lines [X86] FastISel fall back on !absolute_symbol GVs Summary: 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. Reviewers: pcc, craig.topper Reviewed By: pcc Subscribers: hiraditya, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D50116 ------------------------------------------------------------------------ llvm-svn: 338847
1 parent 6d8abb0 commit 6979410

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

llvm/lib/Target/X86/X86FastISel.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,10 @@ bool X86FastISel::handleConstantAddresses(const Value *V, X86AddressMode &AM) {
738738
if (GV->isThreadLocal())
739739
return false;
740740

741+
// Can't handle !absolute_symbol references yet.
742+
if (GV->isAbsoluteSymbolRef())
743+
return false;
744+
741745
// RIP-relative addresses can't have additional register operands, so if
742746
// we've already folded stuff into the addressing mode, just force the
743747
// global value into its own register, which we can use as the basereg.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
; RUN: llc < %s | FileCheck %s
2+
; RUN: llc -relocation-model=pic < %s | FileCheck %s
3+
4+
; Regression test for PR38200
5+
6+
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7+
target triple = "x86_64-unknown-linux-gnu"
8+
9+
@bit_mask8 = external hidden global i8, !absolute_symbol !0
10+
11+
declare void @f()
12+
13+
define void @foo8(i8* %ptr) noinline optnone {
14+
%load = load i8, i8* %ptr
15+
; CHECK: movl $bit_mask8, %ecx
16+
%and = and i8 %load, ptrtoint (i8* @bit_mask8 to i8)
17+
%icmp = icmp eq i8 %and, 0
18+
br i1 %icmp, label %t, label %f
19+
20+
t:
21+
call void @f()
22+
ret void
23+
24+
f:
25+
ret void
26+
}
27+
28+
!0 = !{i64 0, i64 256}

0 commit comments

Comments
 (0)