Files
clang-p2996/llvm/test/Analysis/Lint/crash_empty_iterator.ll
mikaelholmen 2d62ce4beb [ValueTracking] Remove faulty dereference of "InsertBefore" (#85034)
In 2fe81edef6
 [NFC][RemoveDIs] Insert instruction using iterators in Transforms/
we changed
       if (*req_idx != *i)
         return FindInsertedValue(I->getAggregateOperand(), idx_range,
-                                 InsertBefore);
+                                 *InsertBefore);
     }
but there is no guarantee that is InsertBefore is non-empty at that
point,
which we e.g can see in the added testcase.

Instead just pass on the optional InsertBefore in the recursive call to
FindInsertedValue, as we do at several other places already.
2024-03-13 09:58:47 +01:00

23 lines
542 B
LLVM

; RUN: opt -passes="lint" -S < %s | FileCheck %s
; After 2fe81edef6f0b
; [NFC][RemoveDIs] Insert instruction using iterators in Transforms/
; this crashed in FindInsertedValue when dereferencing an empty
; optional iterator.
; Just see that it doesn't crash anymore.
; CHECK-LABEL: @test1
%struct = type { i32, i32 }
define void @test1() {
entry:
%.fca.1.insert = insertvalue %struct zeroinitializer, i32 0, 1
%0 = extractvalue %struct %.fca.1.insert, 0
%1 = tail call %struct @foo(i32 %0)
ret void
}
declare %struct @foo(i32)