1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
llvm-mirror/test/CodeGen/X86/compare-global.ll
Peter Collingbourne 57ac23d53e X86: Teach X86InstrInfo::analyzeCompare to recognize compares of symbols.
This requires that we communicate to X86InstrInfo::optimizeCompareInstr
that the second operand is neither a register nor an immediate. The way we
do that is by setting CmpMask to zero.

Note that there were already instructions where the second operand was not a
register nor an immediate, namely X86::SUB*rm, so also set CmpMask to zero
for those instructions. This seems like a latent bug, but I was unable to
trigger it.

Differential Revision: https://reviews.llvm.org/D28621

llvm-svn: 294634
2017-02-09 21:58:24 +00:00

23 lines
407 B
LLVM

; RUN: llc -o - %s | FileCheck %s
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i686-pc-windows-msvc18.0.0"
@foo = external global i8
define void @f(i8* %c) {
entry:
; CHECK: cmpl $_foo, 4(%esp)
%cmp = icmp eq i8* %c, @foo
br i1 %cmp, label %if.then, label %if.end
if.then:
tail call void @g()
br label %if.end
if.end:
ret void
}
declare void @g()