summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/unittests/Analysis/ValueTrackingTest.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-10-04 20:27:34 +0000
committerpatrick <patrick@openbsd.org>2017-10-04 20:27:34 +0000
commit31eb748944903b7f4f38afda9851951ca9dfc1ae (patch)
tree9b95b6ea45d0874d75eb05b90c0840e191416439 /gnu/llvm/unittests/Analysis/ValueTrackingTest.cpp
parentDon't try to handle IPv4-compatible IPv6 addresses (diff)
downloadwireguard-openbsd-31eb748944903b7f4f38afda9851951ca9dfc1ae.tar.xz
wireguard-openbsd-31eb748944903b7f4f38afda9851951ca9dfc1ae.zip
Import LLVM 5.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/unittests/Analysis/ValueTrackingTest.cpp')
-rw-r--r--gnu/llvm/unittests/Analysis/ValueTrackingTest.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/gnu/llvm/unittests/Analysis/ValueTrackingTest.cpp b/gnu/llvm/unittests/Analysis/ValueTrackingTest.cpp
index ba0d30d59b6..3c8ecfbe1ee 100644
--- a/gnu/llvm/unittests/Analysis/ValueTrackingTest.cpp
+++ b/gnu/llvm/unittests/Analysis/ValueTrackingTest.cpp
@@ -219,7 +219,7 @@ TEST(ValueTracking, GuaranteedToTransferExecutionToSuccessor) {
assert(F && "Bad assembly?");
auto &BB = F->getEntryBlock();
- ArrayRef<bool> ExpectedAnswers = {
+ bool ExpectedAnswers[] = {
true, // call void @nounwind_readonly(i32* %p)
true, // call void @nounwind_argmemonly(i32* %p)
false, // call void @throws_but_readonly(i32* %p)
@@ -239,3 +239,22 @@ TEST(ValueTracking, GuaranteedToTransferExecutionToSuccessor) {
Index++;
}
}
+
+TEST(ValueTracking, ComputeNumSignBits_PR32045) {
+ StringRef Assembly = "define i32 @f(i32 %a) { "
+ " %val = ashr i32 %a, -1 "
+ " ret i32 %val "
+ "} ";
+
+ LLVMContext Context;
+ SMDiagnostic Error;
+ auto M = parseAssemblyString(Assembly, Error, Context);
+ assert(M && "Bad assembly?");
+
+ auto *F = M->getFunction("f");
+ assert(F && "Bad assembly?");
+
+ auto *RVal =
+ cast<ReturnInst>(F->getEntryBlock().getTerminator())->getOperand(0);
+ EXPECT_EQ(ComputeNumSignBits(RVal, M->getDataLayout()), 1u);
+}