|
25 | 25 |
|
26 | 26 | using namespace llvm; |
27 | 27 |
|
28 | | -static bool isAligned(const Value *Base, const APInt &Offset, Align Alignment, |
| 28 | +static bool isAligned(const Value *Base, Align Alignment, |
29 | 29 | const DataLayout &DL) { |
30 | | - Align BA = Base->getPointerAlignment(DL); |
31 | | - return BA >= Alignment && Offset.isAligned(BA); |
| 30 | + return Base->getPointerAlignment(DL) >= Alignment; |
32 | 31 | } |
33 | 32 |
|
34 | 33 | /// Test if V is always a pointer to allocated and suitably aligned memory for |
@@ -118,8 +117,7 @@ static bool isDereferenceableAndAlignedPointer( |
118 | 117 | // As we recursed through GEPs to get here, we've incrementally checked |
119 | 118 | // that each step advanced by a multiple of the alignment. If our base is |
120 | 119 | // properly aligned, then the original offset accessed must also be. |
121 | | - APInt Offset(DL.getTypeStoreSizeInBits(V->getType()), 0); |
122 | | - return isAligned(V, Offset, Alignment, DL); |
| 120 | + return isAligned(V, Alignment, DL); |
123 | 121 | } |
124 | 122 |
|
125 | 123 | /// TODO refactor this function to be able to search independently for |
@@ -154,8 +152,7 @@ static bool isDereferenceableAndAlignedPointer( |
154 | 152 | // checked that each step advanced by a multiple of the alignment. If |
155 | 153 | // our base is properly aligned, then the original offset accessed |
156 | 154 | // must also be. |
157 | | - APInt Offset(DL.getTypeStoreSizeInBits(V->getType()), 0); |
158 | | - return isAligned(V, Offset, Alignment, DL); |
| 155 | + return isAligned(V, Alignment, DL); |
159 | 156 | } |
160 | 157 | } |
161 | 158 | } |
|
0 commit comments