mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 15:41:35 +08:00
The data-layout independent constant folding currently has some rather gnarly code for canonicalizing GEP indices to reduce "notional overindexing", and then infers inbounds based on that canonicalization. Now that we canonicalize to i8 GEPs, this canonicalization is essentially useless, as we'll discard it as soon as the GEP hits the data-layout aware constant folder anyway. As such, I'd like to remove this code entirely. This shouldn't have any impact on optimization capabilities.
29 lines
969 B
HLSL
29 lines
969 B
HLSL
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
|
|
// RUN: dxil-pc-shadermodel6.3-library %s \
|
|
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
|
|
|
|
// CHECK: @[[CB:.+]] = external constant { float, double }
|
|
cbuffer A : register(b0, space2) {
|
|
float a;
|
|
double b;
|
|
}
|
|
|
|
// CHECK: @[[TB:.+]] = external constant { float, double }
|
|
tbuffer A : register(t2, space1) {
|
|
float c;
|
|
double d;
|
|
}
|
|
|
|
float foo() {
|
|
// CHECK: load float, ptr @[[CB]], align 4
|
|
// CHECK: load double, ptr getelementptr ({ float, double }, ptr @[[CB]], i32 0, i32 1), align 8
|
|
// CHECK: load float, ptr @[[TB]], align 4
|
|
// CHECK: load double, ptr getelementptr ({ float, double }, ptr @[[TB]], i32 0, i32 1), align 8
|
|
return a + b + c*d;
|
|
}
|
|
|
|
// CHECK: !hlsl.cbufs = !{![[CBMD:[0-9]+]]}
|
|
// CHECK: !hlsl.srvs = !{![[TBMD:[0-9]+]]}
|
|
// CHECK: ![[CBMD]] = !{ptr @[[CB]], i32 13, i32 0, i1 false, i32 0, i32 2}
|
|
// CHECK: ![[TBMD]] = !{ptr @[[TB]], i32 15, i32 0, i1 false, i32 2, i32 1}
|