llvm.org GIT mirror llvm / 4b32896
[BasicAA] Stop crashing when dealing with pointers > 64 bits. An alternative (and probably better) fix would be that of making `Scale` an APInt, and there's a patch floating around to do this. As we're still discussing it, at least stop crashing in the meanwhile (added bonus, we now have a regression test for this situation). Fixes PR35843. Thanks to Eli for suggesting the fix and Simon for reporting and reducing the bug. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322467 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 2 years ago
2 changed file(s) with 19 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
502502 Index = GetLinearExpression(Index, IndexScale, IndexOffset, ZExtBits,
503503 SExtBits, DL, 0, AC, DT, NSW, NUW);
504504
505 // All GEP math happens in the width of the pointer type,
506 // so we can truncate the value to 64-bits as we don't handle
507 // currently pointers larger than 64 bits and we would crash
508 // later. TODO: Make `Scale` an APInt to avoid this problem.
509 if (IndexScale.getBitWidth() > 64)
510 IndexScale = IndexScale.sextOrTrunc(64);
511
505512 // The GEP index scale ("Scale") scales C1*V+C2, yielding (C1*V+C2)*Scale.
506513 // This gives us an aggregate computation of (C1*Scale)*V + C2*Scale.
507514 Decomposed.OtherOffset += IndexOffset.getSExtValue() * Scale;
0 ; RUN: opt %s -aa-eval -disable-output 2>&1 | FileCheck %s
1
2 ; CHECK: 6 Total Alias Queries Performed
3 ; CHECK-NEXT: 6 no alias responses
4
5 define void @patatino() {
6 BB:
7 %G22 = getelementptr i1*, i1** undef, i8 -1
8 %B1 = mul i66 undef, 9223372036854775808
9 %G45 = getelementptr i1**, i1*** undef, i66 %B1
10 ret void
11 }