diff options
Diffstat (limited to 'llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index f2bd585a8f3..e627be0b23d 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -1848,9 +1848,9 @@ void NVPTXAsmPrinter::bufferLEByte(const Constant *CPV, int Bytes, ConvertIntToBytes<>(ptr, int32); aggBuffer->addBytes(ptr, 4, Bytes); break; - } else if (const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) { - if (const ConstantInt *constInt = dyn_cast<ConstantInt>( - ConstantFoldConstantExpression(Cexpr, DL))) { + } else if (const auto *Cexpr = dyn_cast<ConstantExpr>(CPV)) { + if (const auto *constInt = dyn_cast_or_null<ConstantInt>( + ConstantFoldConstant(Cexpr, DL))) { int int32 = (int)(constInt->getZExtValue()); ConvertIntToBytes<>(ptr, int32); aggBuffer->addBytes(ptr, 4, Bytes); @@ -1871,8 +1871,8 @@ void NVPTXAsmPrinter::bufferLEByte(const Constant *CPV, int Bytes, aggBuffer->addBytes(ptr, 8, Bytes); break; } else if (const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) { - if (const ConstantInt *constInt = dyn_cast<ConstantInt>( - ConstantFoldConstantExpression(Cexpr, DL))) { + if (const auto *constInt = dyn_cast_or_null<ConstantInt>( + ConstantFoldConstant(Cexpr, DL))) { long long int64 = (long long)(constInt->getZExtValue()); ConvertIntToBytes<>(ptr, int64); aggBuffer->addBytes(ptr, 8, Bytes); @@ -2074,8 +2074,8 @@ NVPTXAsmPrinter::lowerConstantForGV(const Constant *CV, bool ProcessingGeneric) // If the code isn't optimized, there may be outstanding folding // opportunities. Attempt to fold the expression using DataLayout as a // last resort before giving up. - if (Constant *C = ConstantFoldConstantExpression(CE, getDataLayout())) - if (C != CE) + if (Constant *C = ConstantFoldConstant(CE, getDataLayout())) + if (C && C != CE) return lowerConstantForGV(C, ProcessingGeneric); // Otherwise report the problem to the user. |