summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authoraqjune <aqjune@gmail.com>2019-11-07 01:12:17 +0900
committerJuneyoung Lee <aqjune@gmail.com>2019-11-12 12:13:26 +0900
commit4187cb138b1c8401a78ac2ea98466c750cce61cb (patch)
tree26537911ca77f9ea1a8678314138639fe933732a /llvm/lib/Analysis/ValueTracking.cpp
parent70193b21d18ba0e4f9b9f68918c71bd91a887246 (diff)
downloadbcm5719-llvm-4187cb138b1c8401a78ac2ea98466c750cce61cb.tar.gz
bcm5719-llvm-4187cb138b1c8401a78ac2ea98466c750cce61cb.zip
Add InstCombine/InstructionSimplify support for Freeze Instruction
Summary: - Add llvm::SimplifyFreezeInst - Add InstCombiner::visitFreeze - Add llvm tests Reviewers: majnemer, sanjoy, reames, lebedev.ri, spatel Reviewed By: reames, lebedev.ri Subscribers: reames, lebedev.ri, filcab, regehr, trentxintong, llvm-commits Differential Revision: https://reviews.llvm.org/D29013
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index cc5acf5d010..b26c6294dce 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4221,6 +4221,20 @@ bool llvm::isOverflowIntrinsicNoWrap(const WithOverflowInst *WO,
return llvm::any_of(GuardingBranches, AllUsesGuardedByBranch);
}
+bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V) {
+ // If the value is a freeze instruction, then it can never
+ // be undef or poison.
+ if (isa<FreezeInst>(V))
+ return true;
+ // TODO: Some instructions are guaranteed to return neither undef
+ // nor poison if their arguments are not poison/undef.
+
+ // TODO: Deal with other Constant subclasses.
+ if (isa<ConstantInt>(V) || isa<GlobalVariable>(V))
+ return true;
+
+ return false;
+}
OverflowResult llvm::computeOverflowForSignedAdd(const AddOperator *Add,
const DataLayout &DL,
OpenPOWER on IntegriCloud