Make sure that foreach() statements never execute with an "all off" mask.
This commit is contained in:
18
ast.cpp
18
ast.cpp
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2011, Intel Corporation
|
Copyright (c) 2011-2012, Intel Corporation
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
@@ -32,8 +32,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** @file ast.cpp
|
/** @file ast.cpp
|
||||||
@brief
|
|
||||||
*/
|
@brief General functionality related to abstract syntax trees and
|
||||||
|
traversal of them.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "ast.h"
|
#include "ast.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
@@ -363,6 +365,16 @@ lCheckAllOffSafety(ASTNode *node, void *data) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dynamic_cast<ForeachStmt *>(node) != NULL) {
|
||||||
|
// foreach() statements also shouldn't be run with an all-off mask.
|
||||||
|
// Since they re-establish an 'all on' mask, this would be pretty
|
||||||
|
// unintuitive. (More generally, it's possibly a little strange to
|
||||||
|
// allow foreach() in the presence of any non-uniform control
|
||||||
|
// flow...)
|
||||||
|
*okPtr = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (g->target.allOffMaskIsSafe == true)
|
if (g->target.allOffMaskIsSafe == true)
|
||||||
// Don't worry about memory accesses if we have a target that can
|
// Don't worry about memory accesses if we have a target that can
|
||||||
// safely run them with the mask all off
|
// safely run them with the mask all off
|
||||||
|
|||||||
Reference in New Issue
Block a user