-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathAIEIRUtils.h
More file actions
55 lines (44 loc) · 2.19 KB
/
Copy pathAIEIRUtils.h
File metadata and controls
55 lines (44 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//===- AIEIRUtils.h - AIE IR Utility Functions ------------------*- C++ -*-===//
//
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// (c) Copyright 2025-2026 Advanced Micro Devices, Inc. or its affiliates
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_AIE_UTILS_AIEIRUTILS_H
#define LLVM_LIB_TARGET_AIE_UTILS_AIEIRUTILS_H
#include <optional>
namespace llvm {
class Instruction;
class IntrinsicInst;
class Type;
class InstCombiner;
} // namespace llvm
namespace llvm::AIEIRUtils {
/// True if I is a call to @llvm.set.loop.iterations or
/// @llvm.start.loop.iterations, the intrinsics that establish a hardware-loop
/// trip count.
bool isHardwareLoopSetup(const Instruction *I);
/// True if I is a call to @llvm.loop.decrement, the intrinsic that controls a
/// hardware-loop latch branch.
bool isHardwareLoopDecrement(const Instruction *I);
/// Helper function to recursively check if a user (and all its users if it's a
/// bitcast) access lanes higher than HighestLane.
bool checkIfUsersDontAccessLanesHigherThan(Instruction *User, Type *CurrentType,
Instruction *Source,
int HighestLane);
/// Check if all users of the intrinsic instruction discard the upper half of
/// the result vector. This is determined by verifying that users only extract
/// the lower half lanes through shuffle operations with a sequential mask.
bool isUpperPartOfResultDiscarded(IntrinsicInst &II);
/// Simplify demanded bits for an intrinsic instruction.
/// Uses InstCombiner to simplify the specified operand to only the low NumBits.
/// Operand defaults to 0 if not specified.
std::optional<Instruction *> instCombineDemandedBits(InstCombiner &IC,
IntrinsicInst &II,
unsigned NumBits,
unsigned Operand = 0);
} // namespace llvm::AIEIRUtils
#endif // LLVM_LIB_TARGET_AIE_UTILS_AIEIRUTILS_H