File tree 1 file changed +29
-7
lines changed
llvm/lib/Transforms/Utils 1 file changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -2015,16 +2015,38 @@ bool llvm::LowerConstantExpr(Function &F) {
2015
2015
2016
2016
for (BasicBlock &BB : F) {
2017
2017
// Skip EHPad basic block.
2018
- if (BB.isEHPad ()) continue ;
2018
+ if (BB.isEHPad ())
2019
+ continue ;
2019
2020
for (Instruction &I : BB) {
2020
- // Skip EHPad instruction
2021
- if (I.isEHPad ()) continue ;
2022
- for (unsigned int Index = 0 ; Index < I.getNumOperands (); ++Index) {
2023
- if (ConstantExpr *CE =
2024
- dyn_cast<ConstantExpr>(I.getOperand (Index))) {
2025
- SavedList.push_back (&I);
2021
+ // Skip EHPad instruction
2022
+ if (I.isEHPad ())
2023
+ continue ;
2024
+
2025
+ // Skip specific annotation instruction
2026
+ if (I.hasMetadata (" annotation" )) {
2027
+ MDNode *Annotations = I.getMetadata (" annotation" );
2028
+ for (unsigned i = 0 ; i < Annotations->getNumOperands (); ++i) {
2029
+ if (MDNode *Annotation =
2030
+ dyn_cast<MDNode>(Annotations->getOperand (i))) {
2031
+ if (MDString *AnnotationName =
2032
+ dyn_cast<MDString>(Annotation->getOperand (0 ))) {
2033
+ if (AnnotationName->getString () == " kcfi" ) {
2034
+ // Skip kcfi
2035
+ goto NextInstruction;
2036
+ }
2026
2037
}
2038
+ }
2039
+ }
2040
+ }
2041
+
2042
+ for (unsigned int Index = 0 ; Index < I.getNumOperands (); ++Index) {
2043
+ if (ConstantExpr *CE = dyn_cast<ConstantExpr>(I.getOperand (Index))) {
2044
+ SavedList.push_back (&I);
2027
2045
}
2046
+ }
2047
+
2048
+ NextInstruction:
2049
+ ;
2028
2050
}
2029
2051
}
2030
2052
You can’t perform that action at this time.
0 commit comments