aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-10-11 04:21:51 +0000
committerDavide Italiano <davide@freebsd.org>2017-10-11 04:21:51 +0000
commitc65eb3a4b70a119da41ff2d3ebce0b037f92cba7 (patch)
tree73a6092670e5124e6a4bd677f3a13383a384e3d9 /lib/Transforms
parent9f81bdc36b453f32667d09c84d1b6add3a759a85 (diff)
downloadllvm-c65eb3a4b70a119da41ff2d3ebce0b037f92cba7.tar.gz
[GVN] Don't replace constants with constants.
This fixes PR34908. Patch by Alex Crichton! Differential Revision: https://reviews.llvm.org/D38765 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315429 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/GVN.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index 4e24d755c26..c3cc2375e3b 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -1362,6 +1362,11 @@ bool GVN::processAssumeIntrinsic(IntrinsicInst *IntrinsicI) {
}
markInstructionForDeletion(IntrinsicI);
return false;
+ } else if (isa<Constant>(V)) {
+ // If it's not false, and constant, it must evaluate to true. This means our
+ // assume is assume(true), and thus, pointless, and we don't want to do
+ // anything more here.
+ return false;
}
Constant *True = ConstantInt::getTrue(V->getContext());