From 811482a82b3d6721bbe80be123fd0b614c7f292e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 18 Jan 2005 04:18:32 +0000 Subject: [PATCH] Do not emit loads multiple times, potentially in the wrong places. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19661 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelPattern.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Target/X86/X86ISelPattern.cpp b/lib/Target/X86/X86ISelPattern.cpp index 7b465cd84ca..4db13aa9ec2 100644 --- a/lib/Target/X86/X86ISelPattern.cpp +++ b/lib/Target/X86/X86ISelPattern.cpp @@ -573,7 +573,7 @@ bool ISel::MatchAddress(SDOperand N, X86ISelAddressMode &AM) { // Okay, we know that we have a scale by now. However, if the scaled // value is an add of something and a constant, we can fold the // constant into the disp field here. - if (ShVal.Val->getOpcode() == ISD::ADD && !ExprMap.count(ShVal) && + if (ShVal.Val->getOpcode() == ISD::ADD && ShVal.hasOneUse() && isa(ShVal.Val->getOperand(1))) { AM.IndexReg = ShVal.Val->getOperand(0); ConstantSDNode *AddVal = @@ -604,7 +604,7 @@ bool ISel::MatchAddress(SDOperand N, X86ISelAddressMode &AM) { // Okay, we know that we have a scale by now. However, if the scaled // value is an add of something and a constant, we can fold the // constant into the disp field here. - if (MulVal.Val->getOpcode() == ISD::ADD && !ExprMap.count(MulVal) && + if (MulVal.Val->getOpcode() == ISD::ADD && MulVal.hasOneUse() && isa(MulVal.Val->getOperand(1))) { Reg = MulVal.Val->getOperand(0); ConstantSDNode *AddVal = -- 2.34.1