OSDN Git Service
(root)
/
android-x86
/
external-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
160f6cc
)
fold compare of null pointer into compare with 0.
author
Chris Lattner
<sabre@nondot.org>
Wed, 15 Oct 2008 05:18:04 +0000
(
05:18
+0000)
committer
Chris Lattner
<sabre@nondot.org>
Wed, 15 Oct 2008 05:18:04 +0000
(
05:18
+0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57553
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Target/X86/X86FastISel.cpp
patch
|
blob
|
history
diff --git
a/lib/Target/X86/X86FastISel.cpp
b/lib/Target/X86/X86FastISel.cpp
index
954a3a0
..
e04e91a
100644
(file)
--- a/
lib/Target/X86/X86FastISel.cpp
+++ b/
lib/Target/X86/X86FastISel.cpp
@@
-549,6
+549,10
@@
bool X86FastISel::X86FastEmitCompare(Value *Op0, Value *Op1, MVT VT) {
unsigned Op0Reg = getRegForValue(Op0);
if (Op0Reg == 0) return false;
+ // Handle 'null' like i32/i64 0.
+ if (isa<ConstantPointerNull>(Op1))
+ Op1 = Constant::getNullValue(TD.getIntPtrType());
+
// We have two options: compare with register or immediate. If the RHS of
// the compare is an immediate that we can fold into this compare, use
// CMPri, otherwise use CMPrr.