[llvm] [GlobalISel] Preserve original flags of output instructions in matchtable (PR #130937)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 12 02:59:22 PDT 2025
https://github.com/Pierre-vh created https://github.com/llvm/llvm-project/pull/130937
We don't have any combine in trunk that uses output MIFlags when using MIR pattenrs, but I tried writing one and noticed that the flags were lost.
The reason is that the MatchTableExecutor was overwriting the flags.
>From 1a82dea47d3b32eb04691a0922dca630a287c4f8 Mon Sep 17 00:00:00 2001
From: pvanhout <pierre.vanhoutryve at amd.com>
Date: Wed, 12 Mar 2025 10:58:16 +0100
Subject: [PATCH] [GlobalISel] Preserve original flags of output instructions
in match table
We don't have any combine in trunk that uses output MIFlags when using MIR pattenrs, but I tried writing one and noticed that the flags were lost.
The reason is that the MatchTableExecutor was overwriting the flags.
---
llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
index 2c57f2b5aa029..654112e86e873 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
@@ -80,7 +80,7 @@ bool GIMatchTableExecutor::executeMatchTable(
for (auto MIB : OutMIs) {
// Set the NoFPExcept flag when no original matched instruction could
// raise an FP exception, but the new instruction potentially might.
- uint16_t MIBFlags = Flags;
+ uint16_t MIBFlags = Flags | MIB.getInstr()->getFlags();
if (NoFPException && MIB->mayRaiseFPException())
MIBFlags |= MachineInstr::NoFPExcept;
if (Observer)
More information about the llvm-commits
mailing list