Move variable down to use
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 15 Oct 2014 23:37:42 +0000 (23:37 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 15 Oct 2014 23:37:42 +0000 (23:37 +0000)
llvm-svn: 219867

llvm/lib/Target/R600/AMDGPUISelLowering.cpp

index fa384db..b7df3d8 100644 (file)
@@ -2160,10 +2160,6 @@ SDValue AMDGPUTargetLowering::PerformDAGCombine(SDNode *N,
                                        WidthVal);
     }
 
-    APInt Demanded = APInt::getBitsSet(32,
-                                       OffsetVal,
-                                       OffsetVal + WidthVal);
-
     if ((OffsetVal + WidthVal) >= 32) {
       SDValue ShiftVal = DAG.getConstant(OffsetVal, MVT::i32);
       return DAG.getNode(Signed ? ISD::SRA : ISD::SRL, DL, MVT::i32,
@@ -2171,6 +2167,10 @@ SDValue AMDGPUTargetLowering::PerformDAGCombine(SDNode *N,
     }
 
     if (BitsFrom.hasOneUse()) {
+      APInt Demanded = APInt::getBitsSet(32,
+                                         OffsetVal,
+                                         OffsetVal + WidthVal);
+
       APInt KnownZero, KnownOne;
       TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(),
                                             !DCI.isBeforeLegalizeOps());