File: phi_ehpad_ignore_sameval.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (55 lines) | stat: -rw-r--r-- 2,208 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
; This tests that LoopStrengthReduce ignores possible optimizations that are
; not realizable because they would require rewriting EHPad-class instructions.
; If this type of optimization is attempted it will hit the
; "Insertion point must be a normal instruction" assertion.
;
; See also https://bugs.llvm.org/show_bug.cgi?id=48708
;
; RUN: opt -loop-reduce -S %s

target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:6:2:64-S128"

%"class.std::allocator" = type { i8 }
%"class.absl::Storage" = type {}

define void @0() personality ptr undef {
init1:
  %i14 = invoke ptr undef(ptr null, i8 0)
          to label %init2 unwind label %unwind

init2:                                            ; preds = %init1
  %i19 = select i1 undef, ptr null, ptr null
  br label %loop

loop:                                             ; preds = %loop.increment, %init2
  %i21 = phi i64 [ %i24, %loop.increment ], [ 0, %init2 ]
  %i22 = getelementptr %"class.std::allocator", ptr %i19, i64 %i21
  invoke void undef(ptr null, ptr null, ptr %i22)
          to label %loop.increment unwind label %loop.unwind

loop.increment:                                   ; preds = %loop
  %i24 = add i64 %i21, 1
  br label %loop

loop.unwind:                                      ; preds = %loop
  %i26 = catchswitch within none [label %loop.catch] unwind label %unwind

loop.catch:                                       ; preds = %loop.unwind
  %i28 = catchpad within %i26 []
  catchret from %i28 to label %caught

caught:                                           ; preds = %loop.catch
  invoke void undef(ptr null)
          to label %unreach unwind label %unwind

unreach:                                          ; preds = %caught
  unreachable

unwind:                                           ; preds = %caught, %loop.unwind, %init1
  ; This phi node triggers the issue in combination with the optimizable loop
  ; above. It contains %i19 twice, once from %caught (which doesn't have an
  ; EHPad) and once from %loop.unwind, which does have one.
  %i32 = phi ptr [ %i19, %loop.unwind ], [ %i19, %caught ], [ null, %init1 ]
  %i33 = cleanuppad within none []
  cleanupret from %i33 unwind to caller
}