[llvm] [CodeGenPrepare] Return false in AddressingModeMatcher::matchOperationAddr if zext has nneg flag (PR #72098)

Lu Weining via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 02:30:13 PST 2023


https://github.com/SixWeining created https://github.com/llvm/llvm-project/pull/72098

Fix https://github.com/llvm/llvm-project/issues/72046

>From b0d36410b2c847598e9965e00af16919a92a79d2 Mon Sep 17 00:00:00 2001
From: Weining Lu <luweining at loongson.cn>
Date: Mon, 13 Nov 2023 18:24:14 +0800
Subject: [PATCH] [CodeGenPrepare] Return false in
 AddressingModeMatcher::matchOperationAddr if zext has nneg flag

Fix https://github.com/llvm/llvm-project/issues/72046
---
 llvm/lib/CodeGen/CodeGenPrepare.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index fa0c753bff2f073..5a604968e5a8f61 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -4886,6 +4886,10 @@ bool AddressingModeMatcher::matchOperationAddr(User *AddrInst, unsigned Opcode,
     if (!Ext)
       return false;
 
+    // TODO: add comments.
+    if (Ext->hasNonNeg())
+      return false;
+
     // Try to move this ext out of the way of the addressing mode.
     // Ask for a method for doing so.
     TypePromotionHelper::Action TPH =



More information about the llvm-commits mailing list