[llvm] 885d2e4 - [NVPTXAsmPrinter] Avoid use of ConstantExpr::getIntegerCast() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 04:17:55 PDT 2023
Author: Nikita Popov
Date: 2023-11-01T12:17:15+01:00
New Revision: 885d2e43317c1b5e154a1f14c6e6003dcf5680ab
URL: https://github.com/llvm/llvm-project/commit/885d2e43317c1b5e154a1f14c6e6003dcf5680ab
DIFF: https://github.com/llvm/llvm-project/commit/885d2e43317c1b5e154a1f14c6e6003dcf5680ab.diff
LOG: [NVPTXAsmPrinter] Avoid use of ConstantExpr::getIntegerCast() (NFC)
Sync the implementation with the original AsmPrinter code.
Added:
Modified:
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index aa4d5fb7298ef49..1ee0b09f9871268 100644
--- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -2024,9 +2024,12 @@ NVPTXAsmPrinter::lowerConstantForGV(const Constant *CV, bool ProcessingGeneric)
// Handle casts to pointers by changing them into casts to the appropriate
// integer type. This promotes constant folding and simplifies this code.
Constant *Op = CE->getOperand(0);
- Op = ConstantExpr::getIntegerCast(Op, DL.getIntPtrType(CV->getType()),
- false/*ZExt*/);
- return lowerConstantForGV(Op, ProcessingGeneric);
+ Op = ConstantFoldIntegerCast(Op, DL.getIntPtrType(CV->getType()),
+ /*IsSigned*/ false, DL);
+ if (Op)
+ return lowerConstantForGV(Op, ProcessingGeneric);
+
+ break; // Error
}
case Instruction::PtrToInt: {
More information about the llvm-commits
mailing list