Teach computeKnownBits to look through addrspacecast.

This fixes inferring alignment through an addrspacecast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213030 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault
2014-07-15 01:55:03 +00:00
parent e3c3920258
commit 832e3ffdb0
2 changed files with 32 additions and 1 deletions
+2
View File
@@ -29,6 +29,7 @@
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
#include <cstring>
using namespace llvm;
@@ -415,6 +416,7 @@ void llvm::computeKnownBits(Value *V, APInt &KnownZero, APInt &KnownOne,
break; // Can't work with floating point.
case Instruction::PtrToInt:
case Instruction::IntToPtr:
case Instruction::AddrSpaceCast: // Pointers could be different sizes.
// We can't handle these if we don't know the pointer size.
if (!TD) break;
// FALL THROUGH and handle them the same as zext/trunc.