diff options
author | Quentin Colombet <qcolombet@apple.com> | 2014-04-22 01:20:34 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2014-04-22 01:20:34 +0000 |
commit | 8959c39450b6fd86ba6556b0ccdb8c260f8a93a4 (patch) | |
tree | 4c94f9fa80160f1497b6a11b7af7e184adcdeed9 /lib/CodeGen/CodeGenPrepare.cpp | |
parent | bb67355af8ca3a546d286cb682ee3054cda3cf87 (diff) | |
download | llvm-8959c39450b6fd86ba6556b0ccdb8c260f8a93a4.tar.gz llvm-8959c39450b6fd86ba6556b0ccdb8c260f8a93a4.tar.bz2 llvm-8959c39450b6fd86ba6556b0ccdb8c260f8a93a4.tar.xz |
[CodeGenPrepare] Use APInt to check the value of the immediate in a and
while checking candidate for bit field extract.
Otherwise the value may not fit in uint64_t and this will trigger an
assertion.
This fixes PR19503.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206834 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenPrepare.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp index 27fdd5187b..573e3d7b8c 100644 --- a/lib/CodeGen/CodeGenPrepare.cpp +++ b/lib/CodeGen/CodeGenPrepare.cpp @@ -639,9 +639,9 @@ bool isExtractBitsCandidateUse(Instruction *User) { !isa<ConstantInt>(User->getOperand(1))) return false; - unsigned Cimm = dyn_cast<ConstantInt>(User->getOperand(1))->getZExtValue(); + const APInt &Cimm = cast<ConstantInt>(User->getOperand(1))->getValue(); - if (Cimm & (Cimm + 1)) + if ((Cimm & (Cimm + 1)).getBoolValue()) return false; } return true; |