[PATCH 1/1] R600: Use TargetConstant in LowerConstantInitializer

Jan Vesely jan.vesely at rutgers.edu
Sun May 18 12:58:40 PDT 2014


We can only produce legal types at this stage.
TargetConstant is an exception

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---

 This fixes assertion failure (LegalizeDAG.cpp:1171) in one GEGL op.
 The alternative would be to use Constant of
 getSmallestLegalIntType(getPrimitiveSizeInBits) type.

 lib/Target/R600/AMDGPUISelLowering.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Target/R600/AMDGPUISelLowering.cpp b/lib/Target/R600/AMDGPUISelLowering.cpp
index 04924cf..d4c3191 100644
--- a/lib/Target/R600/AMDGPUISelLowering.cpp
+++ b/lib/Target/R600/AMDGPUISelLowering.cpp
@@ -524,7 +524,7 @@ SDValue AMDGPUTargetLowering::LowerConstantInitializer(const Constant* Init,
   if (const ConstantInt *CI = dyn_cast<ConstantInt>(Init)) {
     EVT VT = EVT::getEVT(CI->getType());
     PointerType *PtrTy = PointerType::get(CI->getType(), 0);
-    return DAG.getStore(Chain, DL,  DAG.getConstant(*CI, VT), InitPtr,
+    return DAG.getStore(Chain, DL,  DAG.getTargetConstant(*CI, VT), InitPtr,
                  MachinePointerInfo(UndefValue::get(PtrTy)), false, false,
                  TD->getPrefTypeAlignment(CI->getType()));
   }
@@ -532,7 +532,7 @@ SDValue AMDGPUTargetLowering::LowerConstantInitializer(const Constant* Init,
   if (const ConstantFP *CFP = dyn_cast<ConstantFP>(Init)) {
     EVT VT = EVT::getEVT(CFP->getType());
     PointerType *PtrTy = PointerType::get(CFP->getType(), 0);
-    return DAG.getStore(Chain, DL, DAG.getConstantFP(*CFP, VT), InitPtr,
+    return DAG.getStore(Chain, DL, DAG.getTargetConstantFP(*CFP, VT), InitPtr,
                  MachinePointerInfo(UndefValue::get(PtrTy)), false, false,
                  TD->getPrefTypeAlignment(CFP->getType()));
   }
-- 
1.9.0




More information about the llvm-commits mailing list