[llvm] [NFC][CodeGen] Add Register guard to ARMMaterializeFP. (PR #182559)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 20 10:18:45 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-arm
Author: Paul Walker (paulwalker-arm)
<details>
<summary>Changes</summary>
This does not directly fix any issue because the implementation indirectly ensures the correct behaviour. However, all the other "<Tgt>Materialize" functions (Int and FP across all targets, including ARMMaterializeInt) have explicit Register guards so for peace of mind I figured it's worth added them.
---
Full diff: https://github.com/llvm/llvm-project/pull/182559.diff
1 Files Affected:
- (modified) llvm/lib/Target/ARM/ARMFastISel.cpp (+3)
``````````diff
diff --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp
index b5244bfb9a80d..80eb0f5f810ff 100644
--- a/llvm/lib/Target/ARM/ARMFastISel.cpp
+++ b/llvm/lib/Target/ARM/ARMFastISel.cpp
@@ -440,6 +440,9 @@ Register ARMFastISel::ARMMoveToIntReg(MVT VT, Register SrcReg) {
// (the high and the low) into integer registers then use a move to get
// the combined constant into an FP reg.
Register ARMFastISel::ARMMaterializeFP(const ConstantFP *CFP, MVT VT) {
+ if (VT != MVT::f32 && VT != MVT::f64)
+ return Register();
+
const APFloat Val = CFP->getValueAPF();
bool is64bit = VT == MVT::f64;
``````````
</details>
https://github.com/llvm/llvm-project/pull/182559
More information about the llvm-commits
mailing list