[llvm] [IR] Use User::getHungOffOperands() in HungoffOperandTraits::op_begin/op_end(). NFC (PR #74744)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 7 10:35:52 PST 2023
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/74744
User::getOperandList has to check the HasHungOffUses bit in Value to determine how the opernad list is stored. If we're using HungoffOperandTraits we can assume how it is stored without checking the flag.
Noticed that the for loop in matchSimpleRecurrence was triggering loop unswitch when built with clang due to specializing based on how the operand list of the PHINode was stored.
This reduces the size my local Release+Asserts build by around 41K.
>From 0eac008df5bb72428277d16dc06663846ad491bf Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 7 Dec 2023 10:28:57 -0800
Subject: [PATCH] [IR] Use User::getHungOffOperands() in
HungoffOperandTraits::op_begin/op_end(). NFC
User::getOperandList has to check the HasHungOffUses bit in
Value to determine how the opernad list is stored. If we're using
HungoffOperandTraits we can assume how it is stored without checking
the flag.
Noticed that the for loop in matchSimpleRecurrence was triggering
loop unswitch when built with clang due to specializing based on
how the operand list of the PHINode was stored.
This reduces the size my local Release+Asserts build by around 41K.
---
llvm/include/llvm/IR/OperandTraits.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/include/llvm/IR/OperandTraits.h b/llvm/include/llvm/IR/OperandTraits.h
index 979ad35019f8c7..ffece6324aab02 100644
--- a/llvm/include/llvm/IR/OperandTraits.h
+++ b/llvm/include/llvm/IR/OperandTraits.h
@@ -94,10 +94,10 @@ struct VariadicOperandTraits {
template <unsigned MINARITY = 1>
struct HungoffOperandTraits {
static Use *op_begin(User* U) {
- return U->getOperandList();
+ return U->getHungOffOperands();
}
static Use *op_end(User* U) {
- return U->getOperandList() + U->getNumOperands();
+ return U->getHungOffOperands() + U->getNumOperands();
}
static unsigned operands(const User *U) {
return U->getNumOperands();
More information about the llvm-commits
mailing list