[PATCH] D93219: [CodeGen] Removes unwanted optimisation for TargetConstantFP
Simon via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 14 07:56:00 PST 2020
simveg created this revision.
simveg added reviewers: efriedma, t.p.northover, dsanders.
Herald added a subscriber: hiraditya.
simveg requested review of this revision.
Herald added a project: LLVM.
This 'FIXME' popped up in the development of an out-of-tree backend.
Quick fix, but first llvm upstream patch, therefore I do not have commit rights, so if approved please commit?
- Test is not included as this came up in an out-of-tree backend (if required, please hint on how to test this).
- Did not break tests in the current test suite.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93219
Files:
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -430,7 +430,6 @@
LLVM_DEBUG(dbgs() << "Optimizing float store operations\n");
// Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr'
- // FIXME: We shouldn't do this for TargetConstantFP's.
// FIXME: move this to the DAG Combiner! Note that we can't regress due
// to phase ordering between legalized code and the dag combiner. This
// probably means that we need to integrate dag combiner and legalizer
@@ -438,10 +437,16 @@
// We generally can't do this one for long doubles.
SDValue Chain = ST->getChain();
SDValue Ptr = ST->getBasePtr();
+ SDValue Value = ST->getValue();
MachineMemOperand::Flags MMOFlags = ST->getMemOperand()->getFlags();
AAMDNodes AAInfo = ST->getAAInfo();
SDLoc dl(ST);
- if (ConstantFPSDNode *CFP = dyn_cast<ConstantFPSDNode>(ST->getValue())) {
+
+ // Don't optimise TargetConstantFP
+ if (Value.getOpcode() == ISD::TargetConstantFP)
+ return SDValue(nullptr, 0);
+
+ if (ConstantFPSDNode *CFP = dyn_cast<ConstantFPSDNode>(Value)) {
if (CFP->getValueType(0) == MVT::f32 &&
TLI.isTypeLegal(MVT::i32)) {
SDValue Con = DAG.getConstant(CFP->getValueAPF().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93219.311592.patch
Type: text/x-patch
Size: 1376 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201214/ebf2cfce/attachment.bin>
More information about the llvm-commits
mailing list