[PATCH] D75543: [ConstantFolding] Always return something from ConstantFoldConstant
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 10:56:20 PST 2020
nikic created this revision.
nikic added reviewers: efriedma, spatel, lebedev.ri.
Herald added subscribers: llvm-commits, jholewinski.
Herald added a project: LLVM.
Spin-off from D75407 <https://reviews.llvm.org/D75407>. As described there, ConstantFoldConstant() currently returns null for non-ConstantExpr/ConstantVector inputs, but otherwise always returns non-null, independently of whether any folding has happened or not.
This is confusing and makes consumer code more complicated. I would expect either that ConstantFoldConstant() returns only if it actually folded something, or that it always returns non-null. I'm going to the latter possibility here, which appears to be more useful considering existing usage.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75543
Files:
include/llvm/Analysis/ConstantFolding.h
include/llvm/Analysis/TargetFolder.h
lib/Analysis/ConstantFolding.cpp
lib/Analysis/InstructionSimplify.cpp
lib/Analysis/Lint.cpp
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/Target/NVPTX/NVPTXAsmPrinter.cpp
lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
lib/Transforms/IPO/GlobalOpt.cpp
lib/Transforms/InstCombine/InstCombineCasts.cpp
lib/Transforms/InstCombine/InstCombineShifts.cpp
lib/Transforms/InstCombine/InstructionCombining.cpp
lib/Transforms/Utils/Evaluator.cpp
lib/Transforms/Utils/VNCoercion.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75543.247950.patch
Type: text/x-patch
Size: 15496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200303/34e6e9d8/attachment.bin>
More information about the llvm-commits
mailing list