diff options
| author | Weiming Zhao <weimingz@codeaurora.org> | 2018-03-08 00:28:25 +0000 |
|---|---|---|
| committer | Weiming Zhao <weimingz@codeaurora.org> | 2018-03-08 00:28:25 +0000 |
| commit | a4259cd3a6268d6b7e27acd45fd6f114e2ac9ac2 (patch) | |
| tree | e9723a0ae0cb207ea811fc2464bf96f440e8febb | |
| parent | ab1e5a187dd92d805bbbef6fb680273b7a2ee3d8 (diff) | |
| download | bcm5719-llvm-a4259cd3a6268d6b7e27acd45fd6f114e2ac9ac2.tar.gz bcm5719-llvm-a4259cd3a6268d6b7e27acd45fd6f114e2ac9ac2.zip | |
[AArch64] Fix UB about shift amount exceeds data bit-width
Summary:
Fixes an UB caught by sanitizer. The shift amount might be larger than 32 so the operand should be 1ULL.
In this patch, we replace the original expression with existing API with uint64_t type.
Reviewers: eli.friedman, rengolin
Reviewed By: rengolin
Subscribers: rengolin, javed.absar, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D44234
llvm-svn: 326969
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp index c4fc79ccd3e..eee59f1e719 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp @@ -1512,7 +1512,7 @@ static bool isBitfieldExtractOpFromAnd(SelectionDAG *CurDAG, SDNode *N, // Because of simplify-demanded-bits in DAGCombine, the mask may have been // simplified. Try to undo that - AndImm |= (1 << NumberOfIgnoredLowBits) - 1; + AndImm |= maskTrailingOnes<uint64_t>(NumberOfIgnoredLowBits); // The immediate is a mask of the low bits iff imm & (imm+1) == 0 if (AndImm & (AndImm + 1)) |

