LLVM
22.0.0git
include
llvm
Support
AlwaysTrue.h
Go to the documentation of this file.
1
//===--- AlwaysTrue.h - Helper for oqaque truthy values --*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_SUPPORT_ALWAYS_TRUE_H
10
#define LLVM_SUPPORT_ALWAYS_TRUE_H
11
12
#include <cstdlib>
13
14
namespace
llvm
{
15
inline
bool
getNonFoldableAlwaysTrue
() {
16
// Some parts of the codebase require a "constant true value" used as a
17
// predicate. These cases require that even with LTO and static linking,
18
// it's not possible for the compiler to fold the value. As compilers
19
// aren't smart enough to know that getenv() never returns -1, this will do
20
// the job.
21
return
std::getenv(
"LLVM_IGNORED_ENV_VAR"
) != (
char
*)-1;
22
}
23
}
// end namespace llvm
24
25
#endif
// LLVM_SUPPORT_ALWAYS_TRUE_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
AddressRanges.h:18
llvm::getNonFoldableAlwaysTrue
bool getNonFoldableAlwaysTrue()
Definition
AlwaysTrue.h:15
Generated on
for LLVM by
1.14.0