[PATCH] D61544: Add FNeg IR constant folding
    Sanjay Patel via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sat May  4 06:56:27 PDT 2019
    
    
  
spatel added inline comments.
================
Comment at: llvm/include/llvm/Analysis/ConstantFolding.h:75-76
+/// Attempt to constant fold a unary operation with the specified
+/// operand. If it fails, it returns a constant expression of the specified
+/// operands.
+Constant *ConstantFoldUnaryOpOperand(unsigned Opcode, Constant *Op,
----------------
spatel wrote:
> IIUC, this comment is wrong. If it fails, it returns a nullptr. No attempt is made to reduce a ConstExpr (ie, there is no SymbolicallyEvaluateUnOp()). 
> 
> The existing comment below for binops looks misleading if I interpreted that correctly.
Oops - disregard. I got my overloads mixed up.
================
Comment at: llvm/test/Transforms/InstCombine/fneg.ll:159-160
 
+; Actual fneg instructions.
+
+define float @fneg_constant() {
----------------
Please pre-commit these tests to trunk, so we'll just show the test diffs from this code patch.
Repository:
  rL LLVM
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61544/new/
https://reviews.llvm.org/D61544
    
    
More information about the llvm-commits
mailing list