[llvm] 0928312 - [IR] Use User::getHungOffOperands() in HungoffOperandTraits::op_begin/op_end(). NFC (#74744)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 11:23:20 PST 2023


Author: Craig Topper
Date: 2023-12-07T11:23:16-08:00
New Revision: 0928312ec882005fa396dedba9a53f0817e4a2fb

URL: https://github.com/llvm/llvm-project/commit/0928312ec882005fa396dedba9a53f0817e4a2fb
DIFF: https://github.com/llvm/llvm-project/commit/0928312ec882005fa396dedba9a53f0817e4a2fb.diff

LOG: [IR] Use User::getHungOffOperands() in HungoffOperandTraits::op_begin/op_end(). NFC (#74744)

User::getOperandList has to check the HasHungOffUses bit in Value to
determine how the operand 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 of llc on my local Release+Asserts build by around
41K.

Added: 
    

Modified: 
    llvm/include/llvm/IR/OperandTraits.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/OperandTraits.h b/llvm/include/llvm/IR/OperandTraits.h
index 979ad35019f8c..ffece6324aab0 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