[llvm] [NVPTX] enforce signed 32 bit type for immediate offset (PR #99682)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 16:07:12 PDT 2024


================
@@ -3914,8 +3914,13 @@ bool NVPTXDAGToDAGISel::SelectADDRri_imp(
         Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), mvt);
       else
         Base = Addr.getOperand(0);
-      Offset = CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(OpNode),
-                                         mvt);
+
+      // Offset is a signed i32 constant in PTX [register+offset] address mode
----------------
AlexMaclean wrote:

I've update the comments. I agree that the name of this function should probably be `fitsSignedIntN` since that is what it's checking, regardless of context. That being said, I'd prefer to use the more specific function even it it may be a little misnamed. 

https://github.com/llvm/llvm-project/pull/99682


More information about the llvm-commits mailing list