llvm-project/llvm/test
Momchil Velikov acf3279a03 For non-null pointer checks, do not descend through out-of-bounds GEPs
In LazyValueInfoImpl::isNonNullAtEndOfBlock we populate a set of
pointers, known to be non-null at the end of a block (e.g. because we
did a load through them). We then infer that any pointer, based on an
element of this set is non-null as well ("based" here meaning a
non-null pointer is the underlying object). This is incorrect, even if
the base pointer was non-null, the value of a GEP, that lacks the
inbounds` attribute, may be null.

This issue appeared as miscompilation of the following test case:

int puts(const char *);

typedef struct iter {
  int *val;
} iter_t;

static long distance(iter_t first, iter_t last) {
  long r = 0;
  for (; first.val != last.val; first.val++)
    ++r;
  return r;
}

int main() {
  int arr[2] = {0};
  iter_t i, j;
  i.val = arr;
  j.val = arr + 1;
  if (distance(i, j) >= 2)
    puts("failed");
  else
    puts("passed");
}

This fixes PR49662.

Differential Revision: https://reviews.llvm.org/D99642
2021-04-09 14:09:23 +01:00
..
Analysis [funcattrs] Infer nosync from instruction walk 2021-04-08 14:05:00 -07:00
Assembler Reapply "OpaquePtr: Turn inalloca into a type attribute" 2021-03-29 08:55:30 -04:00
Bindings [OCaml][Test] Fix and enable debuginfo.ml test 2021-03-28 06:25:39 +05:30
Bitcode Reapply "OpaquePtr: Turn inalloca into a type attribute" 2021-03-29 08:55:30 -04:00
BugPoint
CodeGen [AMDGPU] SIFoldOperands: eagerly delete dead copies 2021-04-09 13:52:54 +01:00
DebugInfo [debug-info][NFC] Set -mtriple to avoid the test failure under other targets. 2021-04-09 04:53:59 +00:00
Demangle
Examples [Orc][examples] Add missing FileCheck for lit test and polish output 2021-04-07 11:12:20 +02:00
ExecutionEngine [lli] Leaving two EH frame tests with MCJIT only after PowerPC failure 2021-03-30 12:28:22 +02:00
Feature [FunctionAttrs] Force old pm in test so it doens't behave differently depending on the configuration setting for this flag 2021-04-09 11:46:19 +02:00
FileCheck [FileCheck] Fix -dump-input per-pattern diagnostic indexing 2021-03-27 10:36:21 -04:00
Instrumentation Reapply "OpaquePtr: Turn inalloca into a type attribute" 2021-03-29 08:55:30 -04:00
Integer Re-apply "[lli] Make -jit-kind=orc the default JIT engine" 2021-03-30 12:08:26 +02:00
JitListener
LTO Remove dead CHECK-ERR line. 2021-03-30 09:31:00 -07:00
Linker Reapply "OpaquePtr: Turn inalloca into a type attribute" 2021-03-29 08:55:30 -04:00
MC [RISCV][NFC] Fix formatting 2021-04-09 14:41:09 +08:00
MachineVerifier [GlobalISel] Add G_ROTR and G_ROTL opcodes for rotates. 2021-03-25 17:23:30 -07:00
Object [TextAPI] Add support for arm64_32 2021-04-01 17:19:12 -07:00
ObjectYAML [lld] Fixed CodeView GuidAdapter::format to handle GUID bytes in the right order. 2021-04-09 05:29:14 +04:00
Other [LoopRotate] Don't split loop pass manager 2021-04-08 22:05:18 +02:00
SafepointIRVerifier
Support
SymbolRewriter
TableGen Revert "[TableGen] Add support for the 'assert' statement in multiclasses" 2021-04-08 13:58:58 -04:00
ThinLTO/X86 Don't use $ as suffix for symbol names in ThinLTOBitcodeWriter and other places 2021-03-29 13:03:52 +02:00
Transforms For non-null pointer checks, do not descend through out-of-bounds GEPs 2021-04-09 14:09:23 +01:00
Unit [lit] Sort test start times based on prior test timing data 2021-03-16 05:23:04 -04:00
Verifier [DebugInfo] Upgrade DISubragne::count to accept DIExpression also 2021-03-30 09:16:55 +05:30
YAMLParser
tools [lld] Fixed CodeView GuidAdapter::format to handle GUID bytes in the right order. 2021-04-09 05:29:14 +04:00
.clang-format
CMakeLists.txt Conditionalize the JIT test dependency 2021-03-30 13:04:02 -07:00
TestRunner.sh
lit.cfg.py [Orc][examples] Add lit ToolSubst for LLJITWithRemoteDebugging example 2021-04-07 09:47:04 +02:00
lit.site.cfg.py.in [test] Add ability to get error messages from CMake for errc substitution 2021-03-15 20:56:08 +01:00