aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/SPIRV
diff options
context:
space:
mode:
authorMichal Paszkowski <michal@paszkowski.org>2024-06-11 11:09:21 -0700
committerGitHub <noreply@github.com>2024-06-11 11:09:21 -0700
commitca6386073308d3c41647d8fc3e2cf72a77d46c76 (patch)
tree4f7a1596fd7062e72305231b96551240b4164614 /llvm/lib/Target/SPIRV
parent9b4f8acf9dd1cd517f923c6de8274eed80879f6c (diff)
downloadllvm-ca6386073308d3c41647d8fc3e2cf72a77d46c76.zip
llvm-ca6386073308d3c41647d8fc3e2cf72a77d46c76.tar.gz
llvm-ca6386073308d3c41647d8fc3e2cf72a77d46c76.tar.bz2
[SPIR-V] Don't change switch condition type in CodeGen opts (#94959)
This change makes sure the preferred switch condition int type size remains the same throughout CodeGen optimizations. The change fixes running several OpenCL applications with -O2 or higher opt levels, and fixes Basic/stream/stream_max_stmt_exceed.cpp DPC++ E2E test with -O2.
Diffstat (limited to 'llvm/lib/Target/SPIRV')
-rw-r--r--llvm/lib/Target/SPIRV/SPIRVISelLowering.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/SPIRV/SPIRVISelLowering.h b/llvm/lib/Target/SPIRV/SPIRVISelLowering.h
index 6fc200a..77356b7 100644
--- a/llvm/lib/Target/SPIRV/SPIRVISelLowering.h
+++ b/llvm/lib/Target/SPIRV/SPIRVISelLowering.h
@@ -68,6 +68,11 @@ public:
// extra instructions required to preserve validity of SPIR-V code imposed by
// the standard.
void finalizeLowering(MachineFunction &MF) const override;
+
+ MVT getPreferredSwitchConditionType(LLVMContext &Context,
+ EVT ConditionVT) const override {
+ return ConditionVT.getSimpleVT();
+ }
};
} // namespace llvm