Skip to content

Commit 84a7363

Browse files
committed
Relax requirements baseSym != nullptr for lvalue
1 parent db28a47 commit 84a7363

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

src/expr.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4911,11 +4911,6 @@ llvm::Value *IndexExpr::GetValue(FunctionEmitContext *ctx) const {
49114911
mask = LLVMMaskAllOn;
49124912
} else {
49134913
Symbol *baseSym = GetBaseSymbol();
4914-
if (llvm::dyn_cast<FunctionCallExpr>(baseExpr) == nullptr && llvm::dyn_cast<BinaryExpr>(baseExpr) == nullptr &&
4915-
llvm::dyn_cast<SelectExpr>(baseExpr) == nullptr) {
4916-
// Don't check if we're doing a function call or pointer arith or select
4917-
AssertPos(pos, baseSym != nullptr);
4918-
}
49194914
mask = lMaskForSymbol(baseSym, ctx);
49204915
}
49214916

@@ -5815,11 +5810,6 @@ llvm::Value *MemberExpr::GetValue(FunctionEmitContext *ctx) const {
58155810
mask = LLVMMaskAllOn;
58165811
} else {
58175812
Symbol *baseSym = GetBaseSymbol();
5818-
if (llvm::dyn_cast<FunctionCallExpr>(expr) == nullptr && llvm::dyn_cast<BinaryExpr>(expr) == nullptr &&
5819-
llvm::dyn_cast<SelectExpr>(expr) == nullptr && llvm::dyn_cast<PtrDerefExpr>(expr) == nullptr) {
5820-
// Don't check if we're doing a function call or pointer arith or select
5821-
AssertPos(pos, baseSym != nullptr);
5822-
}
58235813
mask = lMaskForSymbol(baseSym, ctx);
58245814
}
58255815

tests/lit-tests/2496.ispc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
// This test checks that there is no ICE on the following code.
2-
// RUN: %{ispc} %s -o %t.o --target=host --nostdlib --nowrap 2>&1 | FileCheck %s
32

4-
// CHECK-NOT: FATAL ERROR:
3+
// RUN: %{ispc} --target=host --nowrap --nostdlib --emit-llvm-text --debug-phase=210:210 %s -o - | FileCheck %s
4+
5+
// CHECK-NOT: FATAL ERROR: Unhandled signal sent to process
56
struct S {
67
uint32 a;
78
};
89

910
S v;
1011

11-
void foo1(int i) {
12-
uint32 a = ((S*)(&v) + i)->a;
12+
// CHECK-LABEL: @foo1
13+
// CHECK: __pseudo_gather64_i32
14+
// CHECK: __pseudo_masked_store_i32
15+
uint32 foo1(int i) {
16+
return ((S*)(&v) + i)->a;
1317
}
14-
15-
void foo2(int i) {
16-
uint32 a = (*((S*)(&v) + i)).a;
18+
// CHECK-LABEL: @foo2
19+
// CHECK: __pseudo_gather64_i32
20+
// CHECK: __pseudo_masked_store_i32
21+
uint32 foo2(int i) {
22+
return (*((S*)(&v) + i)).a;
1723
}

tests/lit-tests/2583.ispc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %{ispc} %s -o %t.o --target=host --nostdlib --nowrap 2>&1 | FileCheck %s --allow-empty
2+
3+
// CHECK-NOT: FATAL ERROR: Unhandled signal sent to process
4+
task void sum_M_float_task(uniform float v_out[], uniform float M[], uniform int M_pitch, uniform int N,
5+
uniform int chunk_size) {
6+
uniform int col = taskIndex0 * chunk_size;
7+
8+
uniform float *v_out_chunked = new float[chunk_size];
9+
10+
foreach (row = 0 ... N) {
11+
v_out[row] = ((uniform float *)((uniform int8 *)M + col * M_pitch))[row];
12+
}
13+
}

0 commit comments

Comments
 (0)