llvm-project/polly/test/Isl/CodeGen/scev_looking_through_bitcasts.ll
Roman Lebedev 7ee6c40247
Revert "Reland "[SCEV] Model ptrtoint(SCEVUnknown) cast not as unknown, but as zext/trunc/self of SCEVUnknown"" and it's follow-ups
While we haven't encountered an earth-shattering problem with this yet,
by now it is pretty evident that trying to model the ptr->int cast
implicitly leads to having to update every single place that assumed
no such cast could be needed. That is of course the wrong approach.

Let's back this out, and re-attempt with some another approach,
possibly one originally suggested by Eli Friedman in
https://bugs.llvm.org/show_bug.cgi?id=46786#c20
which should hopefully spare us this pain and more.

This reverts commits 1fb610429308a7c29c5065f5cc35dcc3fd69c8b1,
7324616660fc0995fa8c166e3c392361222d5dbc,
aaafe350bb65dfc24c2cdad4839059ac81899fbe,
e92a8e0c743f83552fac37ecf21e625ba3a4b11e.

I've kept&improved the tests though.
2020-10-14 16:09:18 +03:00

38 lines
1.0 KiB
LLVM

; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
;
; Scalar write of bitcasted value. Instead of writing %b of type
; %structty, the SCEV expression looks through the bitcast such that
; SCEVExpander returns %add.ptr81.i of type i8* to be the new value
; of %b.
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
%structty = type { %structty*, %structty*, i32, [2 x i64] }
define void @bitmap_set_range() {
entry:
%a = ptrtoint i8* undef to i64
br label %cond.end32.i
cond.end32.i:
br i1 false, label %cond.true67.i, label %cond.end73.i
cond.true67.i:
br label %cond.end73.i
cond.end73.i:
%add.ptr81.i = getelementptr inbounds i8, i8* null, i64 %a
%b = bitcast i8* %add.ptr81.i to %structty*
br label %bitmap_element_allocate.exit
bitmap_element_allocate.exit:
%tobool43 = icmp eq %structty* %b, null
ret void
}
; CHECK: polly.stmt.cond.end73.i:
; CHECK-NEXT: %0 = bitcast %structty** %b.s2a to i8**
; CHECK-NEXT: store i8* undef, i8** %0
; CHECK-NEXT: br label %polly.exiting